Unless I'm missing something, I can't seem to use static and dynamic modules together. That is, if I do something like this:
const store = new Vuex({
modules: {ModuleA},
});
export default store;
with a dynamic module loaded later in the load order:
import store from './store';
@Module({name: 'B', namespaced: true, dynamic: true, store})
export default class ModuleB extends VuexModule {
// module definition
}
... then ModuleB (dynamic) breaks ModuleA (static)
As far as I can tell, this is something to do with:
the fact that vuex-module-decorators monkey-patches some custom, namespaced getters onto store.getters (like vuexModuleDecorators/b)
when we register a dynamic module, Vuex resets the getters, which wipes out these monkey-patched getters, which VMD doesn't like
the next time we try to dispatch an action on the static store (ModuleA), VMD checks the wiped getters, can't find the namespaced getter, and then internally calls getModule without a store instance, which obviously isn't going to work on our static module
Unless I'm missing something, I can't seem to use static and dynamic modules together. That is, if I do something like this:
with a dynamic module loaded later in the load order:
... then
ModuleB
(dynamic) breaksModuleA
(static)As far as I can tell, this is something to do with:
vuex-module-decorators
monkey-patches some custom, namespaced getters ontostore.getters
(likevuexModuleDecorators/b
)ModuleA
), VMD checks the wiped getters, can't find the namespaced getter, and then internally callsgetModule
without a store instance, which obviously isn't going to work on our static module