Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is namespacing implemented completely differently to Vuex? #69

Closed
geoidesic opened this issue Mar 16, 2020 · 1 comment
Closed

Why is namespacing implemented completely differently to Vuex? #69

geoidesic opened this issue Mar 16, 2020 · 1 comment

Comments

@geoidesic
Copy link

So in Vuex the way you set up namespacing is like so:

let store = new Vuex.Store({
    modules: {
          moduleA: {
               getters:{}
          }
    }
})

According to the docs for this repo, it sets up namespaces store in a completely different fashion:

new Store({
  state: {
    value: 'from root',
    moduleA: {
      value: 'from A',
      moduleC: {
        value: 'from A/C',
      },
    },
    moduleB: {
      value: 'from B',
    },
  },
})

This is counter-intuitive and makes it impossible to automatically create a store. I'm still having to manually mock everything if I have to completely rewrite it. So I'm struggling to understand what the point of this library is?

Sorry, not meant to be a rant :) just trying to understand.

Maybe I have the complete wrong end of the stick, but my thinking is that I have a namespaces set of stores already. I'm happy with them as is. I just want them mocked, so I can run tests. I really, really don't want to have to manually map every getter, mutation and state pair in order to achieve a mocked store and I can't imagine what the purpose of this library is if it's not automating that?

@posva
Copy link
Owner

posva commented Mar 16, 2020

Yes, it's different. Not having to declare mutations nor actions allows to have a more straightforward way with one single state object which is the result of having modules instead of having to write one state and as many modules as needed.

About reusing existing store stuff: #9

@posva posva closed this as completed Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants