Repository navigation
docs: list the differences from Immer and describe patch behavior - #197
Merged
Merged
Conversation
|
Coverage after merging docs/immer-differences into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #168.
The differences from Immer were spread over a v1 feature table, two FAQ entries, the
create()reference, the Patches guide and the test files, and the table had not been checked against a current Immer. This PR collects them on the Comparison with Immer page, checked against Immer 11.1.18, and describes how Mutative generates and applies patches. It covers the two roadmap items "Document the intentional differences in one place" and "Document patch behavior and important differences from Immer".apply()and JSON Patch compatibility.How the statements were checked
Every behavior that the pages state was run against Immer 11.1.18 and against
mainat243ff7fin 97 cases:current()andoriginal(), nested producers, returned values and Map iteration;apply()with reserved paths, appending, unsupported operations, copies, drafts and undo after redo.The checks changed several statements:
union()of a draft ofnew Set([1, 2])withnew Set([3])returnsSet {3}.arrayLengthAssignment; witharrayLengthAssignment: falsethey equal Immer's.replacepatches in Mutative and remove-and-add pairs in Immer.immer-non-support.test.tspass with Immer 11.1.18 today, so the page cites only cases that still fail there: a draft that escapes into the next state, Map keys that stay mutable after freezing, Set methods, and Map and Set subclasses.The website builds, and its link check passes for 49 pages, including the anchors of the new links. In Chromium at 1280 px, the two tables render without overflow.