Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: change mutation updates to not be based on server vector #37

Merged
merged 7 commits into from
Dec 16, 2023

Conversation

grgbkr
Copy link

@grgbkr grgbkr commented Dec 16, 2023

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.

Copy link

vercel bot commented Dec 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reflect-yjs-tiptap ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 16, 2023 3:42am

@grgbkr grgbkr requested a review from arv December 16, 2023 01:06
@grgbkr grgbkr merged commit 8cbdb5e into main Dec 16, 2023
7 checks passed
@grgbkr grgbkr deleted the grgbkr/no-vector-updates branch December 16, 2023 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant