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.
Dendriform will use Immer. Immer is wonderful, especially its ability to produce patches for implementing concurrent editing and undo & redo functionality.
But Dendriform needs to track how array elements are moved around. Luckily the RFC6902 JSON patch standard that Immer's patches are similar to describes "move" operations. Immer does not produce "move" patches, so this plugin post-processes Immer patches to infer array element movement and produce "move" patches.
When using Immer alone, certain types of changes can lead to a large number of patches because Immer's design optimises for good performance at generation time. A nice side effect of this library is that describing movements naturally reduces the number of patches.
Please note that while this library does some immer patch optimisations that could be used in any project, the main goal of this library is to solve problems for Dendriform. As such, it's API may be a little volatile, and it won't necessarily aim to please the use cases of the general public. You are welcome to use the library as is, copy the source code for your own uses, or even republish the code as a new library if you'd like to take on the responsibility of maintaining a more public-serving variant of it.