laurenashpole/vue-inner-image-zoom

Removed DOM element

Opened this issue · 1 comments

We don't remove the handleLoad listener from img when component is destroyed. In case of slow internet connection, image might be loaded after this component was destroyed (for example, inside dialog or modal). As a result we can have the next error:

TypeError: Cannot read properties of undefined (reading 'getBoundingClientRect')
   ./node_modules/vue-inner-image-zoom/lib/vue-inner-image-zoom.umd.js at line 2855
   ./node_modules/vue-inner-image-zoom/lib/vue-inner-image-zoom.umd.js at line 2724

As a fix, we should remove the event listener or add check for this.$refs.img here:
https://github.com/laurenashpole/vue-inner-image-zoom/blob/master/src/InnerImageZoom/InnerImageZoom.vue#L266

Thanks for flagging this! I'll add a fix in the next update.