yandex-maps-unofficial / vue-yandex-map

Yandex Maps Component for VueJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unmount Error

uys2000 opened this issue · comments

When we change page immediately without waiting a second, It gives that error

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'geoObjects')
    at Proxy.beforeUnmount (vue-yandex-maps.esm.js?29dc:1:1)
    at callWithErrorHandling (runtime-core.esm-bundler.js?21f2:155:1)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?21f2:164:1)
    at hook.__weh.hook.__weh (runtime-core.esm-bundler.js?21f2:2667:1)
    at invokeArrayFns (shared.esm-bundler.js?7817:556:1)
    at unmountComponent (runtime-core.esm-bundler.js?21f2:5584:1)
    at unmount (runtime-core.esm-bundler.js?21f2:5494:1)
    at unmountComponent (runtime-core.esm-bundler.js?21f2:5593:1)
    at unmount (runtime-core.esm-bundler.js?21f2:5494:1)
    at patch (runtime-core.esm-bundler.js?21f2:4458:1)

Error comes from this part of "vue-yandex-maps.esm.js" file, and changing it like that can be temporary solution, but this time it gives another error. However, a new error does not break all application like before.

beforeUnmount: function () {
       this.myMap && this.myMap.geoObjects && this.myMap.geoObjects.removeAll();
},

New Error :)

Uncaught TypeError: Cannot read properties of null (reading 'offsetWidth')
    at Object.getSize (full-a9ffce0fd63bb5a1e51cf340bee7e3156782068f.js:1420:3319)
    at new v (full-a9ffce0fd63bb5a1e51cf340bee7e3156782068f.js:606:1096)
    at new J (full-a9ffce0fd63bb5a1e51cf340bee7e3156782068f.js:618:1508)
    at Proxy.init (vue-yandex-maps.esm.js?29dc:517:1)
    at eval (vue-yandex-maps.esm.js?29dc:243:1)
    at Array.forEach (<anonymous>)
    at e.value (vue-yandex-maps.esm.js?29dc:242:1)
    at eval (vue-yandex-maps.esm.js?29dc:310:1)

Could you make some code example to reproduce?

I reproduced it. You can check it from this repo
When you change page immediately, it will a give error. Then you will not be able to change page anymore.
Also, I captured video about that.

First of all - try to use version 1.1.0 instead os 0.12.x. It must work more stable

Fixed in ver. 0.12.7