-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Not calling vuex Getters when no needed #848
Comments
Are you implying that you are making ajax calls in getters? 🙀 |
A handler function requests ajax once |
So I have this issue with one of my app where evaluating getters on vuex:init is throwing errors and breaks everything. I am using vuex-router-sync and one the getters is written as such : export const stationId = (state, getters, rootState, rootGetters) => {
return rootState.route.params.stationId
} This getter is not meant to be evaluated on init and since vuex-router-sync add the export const stationId = (state, getters, rootState, rootGetters) => {
return rootState.route && rootState.route.params.stationId
} But it feels bad to modify the codebase just for using the devtool. |
What problem does this feature solve?
A SPA website can have different store modules with specific getters for each screen, which can be associated with ajax requests.
Executing all the getters automatically will not only execute all the associated requests, but also can create inconsistencies or very different behaviour.
What does the proposed API look like?
Maybe getters could be collapsed and disabled by default, and call them all only on expand. Allowing to use the rest of tools normally.
The text was updated successfully, but these errors were encountered: