-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
vuex@2.0 getters not registered within dynamic nested modules #248
Comments
Hello @karol-f , thanks for filing this issue. I'm not sure what you think the issue is. You say you tested both versions. What was the expected result, and what was actually happening? Can you reprocude the problem e.g. on jsfiddle.net? Because what you quoted from the release notes just means that you can define getters (alongside actions etc) in modules and nested submodules, and that works perfectly well as far as I can tell. Getters are also collected from all submodules and wrapped accordingly (so they are accessible through But maybe I missunderstand what your issue is about - can you elaborate? |
Hi @LinusBorg - sorry for not providing link with problematic code. Here it is: I define getters in two ways:
As you can see in output Sorry for confusion and not providing link in the first place, regards! |
Okay, now I see the issue. Thanks for the demo, we will look into it. |
@karol-f Could you edit your initial post to include the demo link? |
@LinusBorg Done |
The code to register the
|
It's not missing, though - it'S in the wrong place. When initializing the store, first getters are collected from all modules, then the So the code is there, it would have to be moved into But we will get on it. |
It's fixed on #253 |
Thanks @ktsn !! |
Reading
v2.0.0-rc.1
release notes we can see that getters should be available inside dynamically registered modules:But when looking in
index.js
source code, into dynamic module registration (module()
method) I can see that getters are not propagated:const { state, actions, mutations, modules } = module
Desired behaviour
Dynamically registered module getters should be available.
Current behaviour
http://www.webpackbin.com/E1JVbppL-
I define getters in two ways:
store.js
usinggetters: { rootState: (state) => state }
(when store initializes)widget.js
usinggetters: { moduleState : (state) => state }
(dynamic module registration, usingstore.module(...)
)As you can see in output
this.$store.getters.moduleState
is empty.Tested in
The text was updated successfully, but these errors were encountered: