Description
Describe the bug Because of the way store is initialized, I'm unable to use direct-vuex
stores. Short summary, direct-vuex
is a "wrapper" for vuex
to provide typing for store. Thanks to it you can do this.$store.dispatch.myAction(myPayload)
happily.
To Reproduce Steps to reproduce the behavior:
- create
store
viacreateDirectStore
fromdirect-vuex
. - result of this function is already a
Vuex.Store
so initialization inrender
fails (getters should be function)
Expected behavior
I can use direct-vuex
stores.
I'm skipping few sections as I already know the solution (or at least where problem originates):
if (store) {
const Vuex = require('vuex')
localVue.use(Vuex)
vuexStore = new Vuex.Store(store)
}
I do realize why it's written this way.
Question to the maintainers is, how do you want to implement it. Or whenever you want to implement it at all! There could be boolean switch in additionalOptions to skip store initialization (like initializeStore
, by default set to true, to not break API), or some other options like directVuexStore
which you can use to add to the Vue
instance instead of plain store
. I'm happy to help with this in any way you need.