Behavior at 8.0.1 looks normal as I am changed state from {} to {baz: undefined} and of course, it's a new object.
But at 8.0.2-9.0.2 I see no change from state {} to {} but somehow get a new object, that is cause incomprehension and also cause problems at existing code
Expected behavior
First of all how to properly handle this in 8.0.2-9.0.2.
constnewState=immer.produce(state,draft=>{if(draft.baz!===undefined){// should I have to add checks before each assigning ?draft.baz=undefined;}});
Or there are possibility to force produce to add fields with 'undefined' values?
Environment
Immer version:
I filed this report against the 9.0.2 version of Immer
Occurs with setUseProxies(true)
The text was updated successfully, but these errors were encountered:
Starting from 8.0.2, was changed 'produce' behavior with assigning 'undefined' value. And now it looks not consistent.
Link to repro
https://runkit.com/tvolodimir/immer-undefined-behaviour
To Reproduce
Observed behavior
Behavior at 8.0.1 looks normal as I am changed state from {} to {baz: undefined} and of course, it's a new object.
But at 8.0.2-9.0.2 I see no change from state {} to {} but somehow get a new object, that is cause incomprehension and also cause problems at existing code
Expected behavior
First of all how to properly handle this in 8.0.2-9.0.2.
Or there are possibility to force produce to add fields with 'undefined' values?
Environment
setUseProxies(true)
The text was updated successfully, but these errors were encountered: