You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have app that contain dynamic views (kinda of mini app). Each view have its own module.
Also , in my app have a global filters of the data each view need to show.
Now , every time I change the global filters ,i need to make sure my dynamic view is refresh its own data.
Until now every module implement its own "refresh" action.
Since every dynamic view is like mini-app here , we decide to make them namespaced.
Now when "refresh" is dispatched my module didn't get the "global refresh event".
Simply what I want is to enable the namespaced module to register the some actions under the root namespace. Its enable namespaced modules to participate in root events while changing the namespaced module.
The root actions get the same context of the regular ones.
It's easy to implement in vuex , the question if this is necessary
P.S
maybe do the same for mutations
What does the proposed API look like?
Root propertry :
conststore=newVuex.Store({modules: {files: {namespaced: true,// module assetsstate: { ... },// module state is already nested and not affected by namespace optiongetters: {bigFiles(){ ... }// -> getters['files/bigFiles']},actions: {delete(namespacedContext){ ... },// -> dispatch('files/delete')refresh: {root: true,handler(sameNamespacedContext){ ... }// -> dispatch('refresh')}},mutations: {delete(){ ... }// -> commit('files/delete')}}}})
or new "rootActions" :
conststore=newVuex.Store({modules: {files: {namespaced: true,// module assetsstate: { ... },// module state is already nested and not affected by namespace optionactions: {delete(namespaceContext){ ... }// -> dispatch('files/delete')},rootActions: {refresh(sameNamespaceContext){ ... }// -> dispatch('refresh')},mutations: {delete(){ ... }// -> commit('files/delete')}}}})
The text was updated successfully, but these errors were encountered:
This proposal would be useful for cases where we want every module to have a chance of doing something when an action is dispatched.
For example, many modules may need to handle differently a userUpdated action, but calling each and every namespaced action is unnecessarily more complex than just dispatching a global userUpdated and letting the interested modules catch it.
What problem does this feature solve?
I have app that contain dynamic views (kinda of mini app). Each view have its own module.
Also , in my app have a global filters of the data each view need to show.
Now , every time I change the global filters ,i need to make sure my dynamic view is refresh its own data.
Until now every module implement its own "refresh" action.
Since every dynamic view is like mini-app here , we decide to make them namespaced.
Now when "refresh" is dispatched my module didn't get the "global refresh event".
Simply what I want is to enable the namespaced module to register the some actions under the root namespace. Its enable namespaced modules to participate in root events while changing the namespaced module.
The root actions get the same context of the regular ones.
It's easy to implement in vuex , the question if this is necessary
P.S
maybe do the same for mutations
What does the proposed API look like?
Root propertry :
or new "rootActions" :
The text was updated successfully, but these errors were encountered: