Merged
Conversation
Contributor
Author
|
I based the PR off of the branch in this PR #917 I couldn't figure out how to make a PR into it here, but only the last commit is different between the two |
f49a7f9 to
9f32354
Compare
janthurau
reviewed
Mar 27, 2025
9f32354 to
3d350b1
Compare
3d350b1 to
c7b96cc
Compare
Contributor
Author
|
Thanks @janthurau! |
janthurau
added a commit
that referenced
this pull request
Oct 22, 2025
…6a7bcd). Making applySync async causes timing issues that leads to issues when using PermanentUserData. This can be reproduced by using the playground server with sqlite and a sleep(1000). Additionally, use Y.PermanentUserData, or try to read data from the ydoc in the onSynced event.
janthurau
added a commit
that referenced
this pull request
Oct 23, 2025
… reverts a6a7bcd). Making applySync async causes timing issues that leads to issues when using PermanentUserData. This can be reproduced by using the playground server with sqlite and a sleep(1000). Additionally, use Y.PermanentUserData, or try to read data from the ydoc in the onSynced event." This reverts commit 7192664.
Contributor
|
This causes issues because of yjs/yjs#591, will most likely need to revert this, or at least make sure that Sync1+2 happen before any update message is applied by the MessageReceiver ; our PermanentUserData implementation is broken in v3 (see my comment on the issue above). Looks like a small timing difference breaks the order it if the methods are async. |
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.
This change introduces a
beforeSynchook which is invoked just before the Y.js update is applied to the Y doc.This is different from the existing
onChangehook in that the update has not yet been applied to the document.We have a use-case where we want to inspect the contents of an update before it is actually applied to the Y doc.
This specifically would enable us to revert changes to the document, if we consider them to be invalid, you can read more information here: TypeCellOS/BlockNote-demo-nextjs-hocuspocus#1
We were able to use the
beforeHandleMessagehook for this (implemented here), but it required us to skip over parts of the hocuspocus binary message format, which we felt was brittle.This
beforeSynchook allows us to inspect the Y.js update at the y-sync/protocols level which would be ideal context to revert messages with.