Open
Description
The modules section in the docs states:
By default, actions, mutations and getters inside modules are still registered under the global namespace - this allows multiple modules to react to the same mutation/action type.
I'm left wondering why state properties are nested/namespaced by default but getters are not? It stands to reason that it would behave the same way since the getter(s) belong to the module...
const user = {
state: {
firstName: 'Bob',
lastName: 'Dobalina'
},
getters: {
fullName(state) {
return `${state.firstName} ${state.lastName}`;
}
}
}
const App = {
modules: {
user
}
}
App.state.user.firstName // Yay!
App.state.user.lastName // Yay!
App.getters.fullName // Aye?
I know namespaced
provides this but it's too far reaching IMHO since it affects everything else. I'd rather be predictable with action and mutation names (especially since I'm using TypeScript) but allow getters to naturally go where they should, just like state properties do.
Metadata
Metadata
Assignees
Labels
No labels