When namespacing a module, the most important part is ensuring that calls to mapActions, mapState, mapGetters, and dispatch are handled correctly. I've provided a few examples below.
Generally for the map* family of vuex functions, you want to (1) see if the mapped properties are part of the visualization module, and (2) make a call to map<State|Actions|Getters>('visualization', ...).
Finally, we have dispatches. Generally I don't think I have any store.dispatch() call that calls a visualization action, but if you ever get an error complaining about some action not existing, then it's probably a visualization action and the corresponding dispatch call should look like dispatch('visualization/<action_name>').
When namespacing a module, the most important part is ensuring that calls to
mapActions
,mapState
,mapGetters
, anddispatch
are handled correctly. I've provided a few examples below.https://github.com/KitwareMedical/paraview-medical/blob/master/src/components/VtkTwoView.vue#L73 is a
mapState()
call that accessesvisualization.worldOrientation
. This technically still works regardless of whether the module is namespaced, but we can be more succinct by rewriting it to be the following:In the same file, we have mapped actions here: https://github.com/KitwareMedical/paraview-medical/blob/master/src/components/VtkTwoView.vue#L479. Actions from un-namespaced modules are registered globally, but with namespaced modules we must make the appropriate
mapActions
invocation:Generally for the
map*
family of vuex functions, you want to (1) see if the mapped properties are part of the visualization module, and (2) make a call tomap<State|Actions|Getters>('visualization', ...)
.Finally, we have dispatches. Generally I don't think I have any
store.dispatch()
call that calls a visualization action, but if you ever get an error complaining about some action not existing, then it's probably a visualization action and the corresponding dispatch call should look likedispatch('visualization/<action_name>')
.