RTC: Fix notes not syncing between collaborative editors#76873
RTC: Fix notes not syncing between collaborative editors#76873
Conversation
PR #76704 introduced `isPrimaryRoom` to only check the primary room for collaborator awareness, but accidentally restricted `updateQueue.resume()` to only the primary room queue. Non-primary rooms (like the `root/comment` collection room used for notes) had their update queues permanently paused, so CRDT save events were never sent to the server and notes never synced between editors. Fix by resuming all room queues when collaborators are detected on the primary room, preserving the optimisation of only checking the primary room for awareness.
|
Size Change: +5 B (0%) Total Size: 7.73 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 905bd65. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23673852695
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Fixes collaborative editing notes (block comments) not syncing between editors. When User A adds a note to a block, User B never sees it until they refresh the page.
Why?
PR #76704 introduced the
isPrimaryRoomconcept to the HTTP polling manager to optimise collaborator detection — only the primary room (the post entity) is checked for awareness to avoid false positives from shared collection rooms liketaxonomy/category.However, the change accidentally restricted
updateQueue.resume()to only the primary room's queue. Non-primary rooms — such as theroot/commentcollection room used for notes — had their update queues permanently paused. Since a paused queue'sget()returns[], CRDT save events frommarkEntityAsSaved()were never sent to the server, and notes never synced between editors.How?
When collaborators are detected on the primary room, resume all room queues instead of just the primary room's queue. This preserves the optimisation of only checking the primary room for collaborator awareness while ensuring collection rooms can also send their updates.
The fix (
packages/sync/src/providers/http-polling/polling-manager.ts):if ( roomState.isPrimaryRoom && Object.keys( room.awareness ).length > 1 ) { hasCollaborators = true; - roomState.updateQueue.resume(); + roomStates.forEach( ( state ) => { + state.updateQueue.resume(); + } ); }Testing Instructions