michitaro / vue-menu

Menu/Contextmenu Component for vue2
https://michitaro.github.io/vue-menu/
MIT License
263 stars 26 forks source link

this.$session.destroy() makes many warnings and errors but menus still function #13

Closed craigmjackson closed 5 years ago

craigmjackson commented 5 years ago

I was using vue-menu very successfully until I tried to add a login page using vue-session.

I can use the menu, login to the session, then continue to use the menu and all is well. Once I run this.$session.destroy() as part of a logout function, the vue-menu still continues to work properly, but many warnings and errors show on the console. There is a warning and a TypeError that repeat asynchronously the first time clicking on a menu after the session is destroyed, and continue even if the session is re-established. I don't see you interacting with the $session object in your code so I am not sure what might be happening. Once I do a reload of the page all is good and there are no warnings and errors again until I perform another this.$session.destroy().

Here is the Error. The TypeError is also repeated without the [Vue warn] context but the output is the same otherwise.

[Vue warn]: Error in event handler for "menubaritemactivate": "TypeError: Cannot read property 'close' of undefined"

found in

---> <E> at src/menubar/index.vue
       <HscMenuStyleBlack>
         <HscMenu> at src/components/Menu.vue
           <App> at src/App.vue
             <Root>
warn @ vue.esm.js?efeb:591
logError @ vue.esm.js?efeb:1737
globalHandleError @ vue.esm.js?efeb:1732
handleError @ vue.esm.js?efeb:1721
Vue.$emit @ vue.esm.js?efeb:2540
e.(anonymous function) @ backend.js:1
e.activate @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
D @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
$ @ index.js?10b9:1
t.challenge @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
(anonymous) @ index.js?10b9:1
$ @ index.js?10b9:1
t.lock @ index.js?10b9:1
e.mousedown @ index.js?10b9:1
invoker @ vue.esm.js?efeb:2027
fn._withTask.fn._withTask @ vue.esm.js?efeb:1826

Thank you for a great component!

michitaro commented 5 years ago

I'm guessing that $session.destroy() removes the menu containing the menu item that triggers $session.destroy(). Is it right?

michitaro commented 5 years ago

I hope the problem is solved in vue-menu@2.8.3.

craigmjackson commented 5 years ago

Yes it was the logout menu item which changed the route to my login screen, which has beforeCreate hook to destroy the session. I see how your changes may help resolve this.

Appreciate your help so quickly. I will try to find out how to test your master branch tomorrow after work. So far I have only worked with released NPM modules.

Thanks!

Craig Jackson

On Sun, Dec 9, 2018, 22:53 Koike Michitaro <notifications@github.com wrote:

I hope the problem is solved in vue-menu@2.8.3.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michitaro/vue-menu/issues/13#issuecomment-445706173, or mute the thread https://github.com/notifications/unsubscribe-auth/AIjQ9f_2QtuYWD9vEchZqUFXsBSbR8q3ks5u3gTTgaJpZM4ZKusT .

michitaro commented 5 years ago

I have pushed the latest version to npm repository, so I believe you can use the latest one by simply doing this.

npm update @hscmap/vue-menu

Check your package.json after updating. 2.8.3 is OK.

craigmjackson commented 5 years ago

Issue has been resolved in 2.8.3. Thank you so much for a very solid and useful component and for your quick response!