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
var{produceWithPatches, nothing, enablePatches}=require("immer")enablePatches(true);let[newState,patches]=produceWithPatches({abc: 123},draft=>nothing);// newState is undefined <- correctpatches[0].value===nothing<-incorrect?
Observed behavior
The immer nothing symbol can appear as the value in "replace" patches. Is this right? I thought the purpose of the nothing symbol was to simply give producers a way of differentiating between a mutating producer that implicitly returned undefined, and a returning producer that wants to output undefined as the next state. If that's true then perhaps the nothing symbol should not appear outside the producer itself.
Expected behavior
Patches that are produced setting state to nothing should have a value of undefined.
Environment
9.0.2
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:
🐛 Bug Report
Link to repro
https://codesandbox.io/s/immer-sandbox-forked-7htbs?file=/src/index.ts
To Reproduce
Observed behavior
The immer
nothing
symbol can appear as the value in"replace"
patches. Is this right? I thought the purpose of thenothing
symbol was to simply give producers a way of differentiating between a mutating producer that implicitly returnedundefined
, and a returning producer that wants to outputundefined
as the next state. If that's true then perhaps thenothing
symbol should not appear outside the producer itself.Expected behavior
Patches that are produced setting state to
nothing
should have a value ofundefined
.Environment
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: