perf: change mutation updates to not be based on server vector #37
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.
The updates in mutations are now just the update message fired by the ydoc. It is not necessary for these to be based on a vector of a previous server state. As long as all update messages are propagated to all clients, all clients will eventually converge to the same state. This is ensured by the reflect mutation/push system ensuring all updates flow from a source ydoc to the server, where they are merged into the server update which is then poked to all clients.
Since the updates in mutations are no longer cumulative each client update is written at its own key (using a uuid). These are not written by the server handling of the mutation, and thus are effectively deleted once they are merged into the server update.
Tested loading of the doc from offline using
kvStore: 'idb'
and also offline persist/refresh.