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
I am using a main Redux state with child-states, each with its own reducer. For some actions I need the main reducer to update the whole state (for example initialisation from server data).
I think I understand why this is not working (reassigning a whole property, not changing it), but I am not finding the proper "immer" way to do so, and I think this is a quite common usecase.
I would expect the same result with a sub-reducer and without it. But when I am using my sub-reducer, the original state is mutated.
I guess the proper solution would be for the sub-reducer to not call produce, but it makes this reducer harder to test.
Environment
Immer version: 2.1.4
Occurs with setUseProxies(true)
Occurs with setUseProxies(false) (ES5 only)
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
First of all, thanks for Immer!
I am using a main Redux state with child-states, each with its own reducer. For some actions I need the main reducer to update the whole state (for example initialisation from server data).
I think I understand why this is not working (reassigning a whole property, not changing it), but I am not finding the proper "immer" way to do so, and I think this is a quite common usecase.
Link to repro (highly encouraged)
See Codesandbox: https://codesandbox.io/s/olo1yo9y3z
To Reproduce
See codesandbox
Expected behavior
I would expect the same result with a sub-reducer and without it. But when I am using my sub-reducer, the original state is mutated.
I guess the proper solution would be for the sub-reducer to not call
produce
, but it makes this reducer harder to test.Environment
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: