Add ability to access namespaced getters with dot notation
### What problem does this feature solve? When working with a namespaced module (e.g. a users module), you can access items on the user module's state like this: `this.$store.state.users.user` However, you can't access getters in the same way. This will return an error: `this.$store.getters.users.newUsers` Because `getters.users` is undefined. Instead you have to access it with bracket notation: `this.$store.getters['users/newUsers']` This is true even though, without modules, I can access getters with dot notation: `this.$store.getters.newUsers` Is there a reason why this isn't possible with getters? It would be nice if we could access namespaced getters in the same way we can with namespaced state. This current behavior seems inconsistent. ### What does the proposed API look like? Given a `users` namespaced module, add the ability to access getters with: `this.$store.getters.users.newUsers` <!-- generated by vue-issues. DO NOT REMOVE -->
Posted by jmcooper on May 5, 2018, 5:00 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Add ability to access namespaced getters with dot notation
### What problem does this feature solve? When working with a namespaced module (e.g. a users module), you can access items on the user module's state like this: `this.$store.state.users.user` However, you can't access getters in the same way. This will return an error: `this.$store.getters.users.newUsers` Because `getters.users` is undefined. Instead you have to access it with bracket notation: `this.$store.getters['users/newUsers']` This is true even though, without modules, I can access getters with dot notation: `this.$store.getters.newUsers` Is there a reason why this isn't possible with getters? It would be nice if we could access namespaced getters in the same way we can with namespaced state. This current behavior seems inconsistent. ### What does the proposed API look like? Given a `users` namespaced module, add the ability to access getters with: `this.$store.getters.users.newUsers` <!-- generated by vue-issues. DO NOT REMOVE -->
Comments (0)
No comments yet. Start the discussion.