Unexpected patches for Dates with applySnapshot #2215
Labels
enhancement
Possible enhancement
help/PR welcome
Help/Pull request from contributors to fix the issue is welcome
level: intermediate
Bug report
Sandbox link or minimal reproduction code
https://codesandbox.io/p/sandbox/mst-autorun-example-forked-7ds6cs?file=%2Findex.ts%3A1%2C1-35%2C1&workspaceId=84a0645a-1491-4074-88e5-f44a8818ef46
Describe the expected behavior
When running
applySnapshot
without changing the value for atypes.Date
, I expect no patches to be emitted.Describe the observed behavior
Patches are emitted even though the values haven't changed.
Other notes
I can guess at the implementation here and why the patch is being emitted:
new Date(123) != new Date(123)
.What I'm wondering is how far we should go to minimize the patches 🤔
Do we close this as "working as intended"? If not, should we avoid emitting a patch for a
types.frozen
with the value{ value: "a" }
and having a snapshot applied with the same value (but a difference instance)?The text was updated successfully, but these errors were encountered: