-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Labels
Description
Current Behavior
Toggling streamtrees on → off → on causes the dev-only immutability middleware check to fail, resulting in an uncaught exception:
redux-toolkit.esm.js:467 Uncaught Error: Invariant failed: A state mutation was detected between dispatches, in the path 'tree.streams.2013 – West Africa.renderingOrder'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)
at invariant (redux-toolkit.esm.js:467:9)
at eval (redux-toolkit.esm.js:610:11)
at Object.measureTime (redux-toolkit.esm.js:367:16)
at eval (redux-toolkit.esm.js:606:22)
at eval (redux-toolkit.esm.js:354:16)
at dispatch (redux.js:627:28)
at eval (treeStreams.ts:42:5)
at:
auspice/src/actions/treeStreams.ts
Line 42 in e6bb917
dispatch({type: TOGGLE_STREAM_TREE, showStreamTrees}) |
Redux doc: Do Not Mutate State
Expected behavior
No error.
Possible solution
I believe this is because TreeState.streams
is mutated in processStreams
, here and further down:
auspice/src/util/treeStreams.ts
Line 111 in e6bb917
streams[sigma] = (pivots.at(-1)-pivots.at(0))/nPivots*5; |