You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case the draft is a boolean, string, null or number and the draft is overwritten by nothing the patch output of produceWithPatches is undefined.
Based on the output of an object or array the output would, for me, expected to be [{op: 'replace', path: [], value: undefined}].
Issue that might be related to this behavior: Github issue
Update: I also found out that any other boolean, string, null or number combination is not recorded in the patches, e.g. changing "foobar" into "something else" is also not recorded.
produceWithPatches second ([1]) output parameter is undefined, in any combination where the original value is not an object.
Expected behavior
Expected output is [{op: 'replace', path: [], value: VALUE}].
Environment
Any browser
Immer: 9.0.7
setUseProxies does not matter.
We only accept bug reports against the latest Immer version.
Immer version:
I filed this report against the latest version of Immer
Occurs with setUseProxies(true)
Occurs with setUseProxies(false) (ES5 only)
The text was updated successfully, but these errors were encountered:
Jimmy89
changed the title
produceWithPatches(draft => nothing) does not provide patch output if draft is not an object
produceWithPatches(draft => return anything) does not provide patch output if draft is not an object
Dec 31, 2021
🐛 Bug Report
In case the draft is a boolean, string, null or number and the draft is overwritten by
nothing
the patch output ofproduceWithPatches
isundefined
.Based on the output of an object or array the output would, for me, expected to be
[{op: 'replace', path: [], value: undefined}]
.Issue that might be related to this behavior: Github issue
Update: I also found out that any other boolean, string, null or number combination is not recorded in the patches, e.g. changing
"foobar"
into"something else"
is also not recorded.Link to repro
To Reproduce
See code snippet above.
Observed behavior
produceWithPatches
second ([1]) output parameter isundefined
, in any combination where the original value is not an object.Expected behavior
Expected output is
[{op: 'replace', path: [], value: VALUE}]
.Environment
Any browser
Immer: 9.0.7
setUseProxies does not matter.
We only accept bug reports against the latest Immer version.
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: