Answer the question
In order to leave comments, you need to log in
How to get rootState or other state in mutations with namespaced enabled?
In general, I broke vuex into modules. Now I want to transfer the general functions to the root module (namespaced is disabled in it).
Now the only thought is to forward the desired state from the action and mutate it.
Maybe there are other ways?
Answer the question
In order to leave comments, you need to log in
I don’t know how good this practice is, but you can get `rootState` inside the mutation through `this.state`, but I repeat: this is more of an undocumented feature, and LinusBorg itself advises using plugins and synchronizing states of different levels, but as for me, this unnecessarily complicates architecture, and sooner or later you can potentially stumble upon an infinite loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question