Skip to content

Unable to use direct-vuex #146

Closed
Closed
@kosciak9

Description

@kosciak9

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 via createDirectStore from direct-vuex.
  • result of this function is already a Vuex.Store so initialization in render 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):

Problematic code here.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions