- Notifications
You must be signed in to change notification settings - Fork23
Open
Description
After the draft function is executed, if the draft tree has not really changed its values, it should return to its original state.
Although Mutative and Immer behave the same behavior, we are considering supporting new behavior, as it can reduce some unexpected shallow comparison performance due to changed states(serializes to the same string).
For example,
constbaseState={a:{b:1}};conststate=produce(baseState,(draft)=>{deletedraft.a.b;draft.a.b=1;});expect(state).not.toBe(baseState);// They should be equal.