Skip to content

The reorderPolygon causes Vuex state mutations outside of a mutation

Errors seen in the JS console in dev due to Vuex's strict mode being enabled:

[Vue warn]: Error in callback for watcher "function () { return this._data.$$state }": "Error: [vuex] do not mutate vuex store state outside mutation handlers." (found in <Root>)
Error: [vuex] do not mutate vuex store state outside mutation handlers.
    assert           vuex.esm.js:90
    enableStrictMode vuex.esm.js:793
    reorderPolygon   polygon.js:72
    create           InteractiveImage.vue:360
    editRectangle    InteractiveImage.vue:427
    mouseAction      InteractiveImage.vue:312
    mouseup          InteractiveImage.vue:42
    mouseup          ImageLayer.vue:28

There probably just needs to be a call to clone(polygon) before updating it.