Vuex: Module registration problem

Hi guys,

I will try to explain my problem as simple as possible:

I have a vuex Module, let say TodoListModule. I use it with a sub-component named TodoList.
When i enter routeA, i use beforeCreate hook of TodoList to register my module.
When i quit routeA, i use beforeDestroy hook of TodoList to unregister my module.

I use lifecyle hook instead of route-guard because my TodoList is a sub-component of another routed component (so route-guard are not triggered in TodoList).

For now, everything works fine.
Now, i have a routeB that also render TodoList sub-component.
Here the problem:

When i go from routeA to routeB, beforeCreate hook of TodoList (routeB) is triggered EARLIER than beforeDestroy hook of TodoList (routeA). Because of this, my module is still considered as registered, and the registration for TodoList (routeB) will not happen. (i check that the module is not already registered).

I could avoid this check, but i will get an error for duplicate registration.

How can i solve this simple case, properly :slight_smile: ?