fix(yjs): let the server decide who seeds an empty room - #3331
Open
JammingBen wants to merge 2 commits into
Open
fix(yjs): let the server decide who seeds an empty room#3331JammingBen wants to merge 2 commits into
JammingBen wants to merge 2 commits into
Conversation
Two clients opening the same file at once could both seed the Y.Doc, and the room then held the body twice. The awareness election that guarded this only waited a guessed 150ms, and a client has no signal that its announce is visible to everyone. The Yjs server now grants seeding to exactly one connection per room. It is the only party that sees every connection at once, so no wait has to be guessed. The grant is permission, not an instruction: the client still checks its own document first, so a grant for a room that already has content costs nothing. It passes to another writer when the holder leaves, and dies with the room.
JammingBen
force-pushed
the
fix/yjs-hydration-race-errors
branch
from
September 8, 2026 09:40
f16fe78 to
fb38a4a
Compare
JammingBen
marked this pull request as ready for review
September 8, 2026 10:24
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.
Two clients opening the same file at once could both seed the Y.Doc, and the room then held the body twice. The awareness election that guarded this only waited a guessed 150ms.
Instead of solving this on the client side, the Yjs server now grants seeding to exactly one connection per room. It is the only party that sees every connection at once.
The grant is permission, not an instruction: the client still checks its own document first, so a grant for a room that already has content costs nothing. It passes to another writer when the holder leaves, and dies with the room.
fixes #3141