iobio / gene.iobio

Gene.iobio vue
MIT License
55 stars 11 forks source link

Silent runtime error occurs when loading saved analysis file #967

Closed tonydisera closed 10 months ago

tonydisera commented 10 months ago

In the console, this message appears:

vue.runtime.esm.js:1888 TypeError: Cannot read properties of null (reading 'type')
    at GeneBadge.vue:467:1
    at Array.forEach (<anonymous>)
    at GeneBadge.vue:466:1
    at Array.forEach (<anonymous>)
    at VueComponent.getImpactClass (GeneBadge.vue:465:1)
    at VueComponent.render (GeneBadge.vue:89:4)
    at Vue._render (vue.runtime.esm.js:3548:1)
    at VueComponent.updateComponent (vue.runtime.esm.js:4066:1)
    at Watcher.get (vue.runtime.esm.js:4479:1)
    at Watcher.run (vue.runtime.esm.js:4554:1)

This null reference can be traced back to DangerSummary.badges.flaggedVariants, which contains an array with null elements.

This is caused by the JSON.stringify because flaggedVariants is an array with elements also in other DangerSummary.badges[filter] arrays. By cloning the variant before pushing it to flaggedVariants, we make these variants unique and ensure that they will not be bypassed (represented as an empty object in JSON.stringify) when the cached analysis file is created.