Weird behavior with TOGGLE_IN
Closed this issue · 1 comments
danielboisselle commented
Using key property, the schema state gets overwritten
State = { "state": [false,false,false] }
D.TOGGLE_IN({ key: "state", value: false })
received: State = { "state": false }
aegorenkov commented
That's the way it works. TOGGLE_IN without a path such as TOGGLE_IN_STATE specifies that you want to do the update to the root object. In this case you are asking to set the value of the prop "state" to false. Furthermore, TOGGLE_IN does nothing with the value prop; use SET or SET_IN instead.
You would want to use D.TOGGLE_IN_STATE({ index:0 })
to toggle the first boolean in the array.
More broadly, we should probably enforce the initial schema to warn or stop atypical updates.