How to use arcgis api 4.x with vuex?

526
1
05-16-2019 12:23 AM
ae
by
Occasional Contributor II

Hi, 

 

I'm trying to use arcgis js api in a vue application which manages state with vuex. Since I have several components that uses the mapview (e.g. search, measure, etc), I would like to share the mapview object via the vuex state. When I try to do this, I get errors like this: 

 

Error: [vuex] do not mutate vuex store state outside mutation handlers. 

 

I'm guessing this is because the mapview is mutating internally. For example the extent is changing when panning the map. Based on this I was thinking that I cannot use vuex to share the mapview. However, there is a project on github (https://github.com/munkh-altai/ArcGIS-Vue) where they actually do this without producing any errors. I've tried replicating the logic of this project in my project but I still get errors. 

 

Does anyone know if it is possible to share the mapview/sceneview/map-object in a vuex store? If so, how? 

Tags (2)
0 Kudos
1 Reply
by Anonymous User
Not applicable

Could you share your code with us?  I inherited a project done in vuex and I might be able to compare/ offer suggestions.

0 Kudos