Skip to content

Real-Time Collaboration: Update sync provider event name and modal handling#74904

Merged
ingeniumed merged 2 commits intoWordPress:wpvip/rtc-pluginfrom
Automattic:update/sync-connection-status-handling
Jan 29, 2026
Merged

Real-Time Collaboration: Update sync provider event name and modal handling#74904
ingeniumed merged 2 commits intoWordPress:wpvip/rtc-pluginfrom
Automattic:update/sync-connection-status-handling

Conversation

@shekharnwagh
Copy link
Contributor

@shekharnwagh shekharnwagh commented Jan 23, 2026

What?

Improves sync connection state handling added in #74075 by fixing event name conflicts and ensuring the disconnection modal displays in all disconnect scenarios.

Why?

Two issues were discovered when integrating with the WebSocket provider - Automattic/real-time-collaboration#145:

  1. Event name conflicts: The WebSocket provider has a built-in 'status' event that conflicts with our sync connection status event. These default WebSocket events don't include custom fields like 'error', causing issues when our custom SyncConnectionState events overlap with them.

  2. Hidden disconnections: The sync connection modal only appeared when connectionState.error existed. This meant users could be disconnected without seeing any indication if the disconnection didn't include a specific error object, leading to confusion about why editing was disabled.

How?

  • Renamed the provider event from 'status' to 'sync-connection-status' to avoid conflicts with WebSocket provider events
  • Changed modal condition to check status !== 'disconnected' instead of checking for error presence

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: shekharnwagh <shekharnwagh@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@chriszarate chriszarate added [Type] Bug An existing feature does not function as intended [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration labels Jan 23, 2026
@chriszarate chriszarate self-requested a review January 23, 2026 20:28
@shekharnwagh shekharnwagh force-pushed the update/sync-connection-status-handling branch 2 times, most recently from 0d0ed65 to d03eee6 Compare January 27, 2026 15:54
Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.
Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
@shekharnwagh shekharnwagh force-pushed the update/sync-connection-status-handling branch from d03eee6 to 0589761 Compare January 27, 2026 18:59
@ingeniumed ingeniumed merged commit 185f7b6 into WordPress:wpvip/rtc-plugin Jan 29, 2026
39 checks passed
@ingeniumed ingeniumed deleted the update/sync-connection-status-handling branch January 29, 2026 04:21
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Jan 29, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit that referenced this pull request Jan 31, 2026
…modal handling (#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit that referenced this pull request Jan 31, 2026
…modal handling (#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Jan 31, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit that referenced this pull request Feb 3, 2026
…modal handling (#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 4, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 4, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 5, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 5, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 6, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
shekharnwagh added a commit to Automattic/gutenberg that referenced this pull request Feb 6, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit that referenced this pull request Feb 9, 2026
…modal handling (#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit to Automattic/gutenberg that referenced this pull request Feb 14, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit to Automattic/gutenberg that referenced this pull request Feb 16, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate pushed a commit to Automattic/gutenberg that referenced this pull request Feb 16, 2026
…ndling (WordPress#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.
chriszarate added a commit that referenced this pull request Feb 17, 2026
* Real-time collaboration: Add sync connection error handling (#74075)

* Add sync connection error handling

Creates a provider-agnostic system for sync providers to report
connection errors and display appropriate UI to users.

* Consolidate sync connection state into core-data

Removes the separate syncConnectionStore and moves connection state
management into core-data. Sync providers now receive an onStateChange
callback to report connection status for both entities and collections.

* Remove sync package dependency from editor

Moves sync error message handling from @wordpress/sync into editor
utils.

* Use event emitter pattern for provider status events

Replace callback injection with event listener pattern for reporting
provider connection status. Providers now expose an on() method that
allows attaching listeners after creation, rather than receiving
callbacks as constructor parameters.

* Document sync provider connection state types

Adds JSDoc to OnStateChangeCallback, ProviderCreatorOptions,
SyncConnectionError, SyncConnectionState, and SyncConnectionStatus.

* Real-time collaboration: Add provider 'connecting' status (#74826)

* Real-time collaboration: Update sync provider event name and modal handling (#74904)

* Rename sync provider status event to prevent conflicts

Renamed the event from 'status' to 'sync-connection-status' to make
it unique and avoid conflicts. This ensures sync-specific connection
state events are distinct from generic provider status events.

* Show sync disconnection modal for all disconnect states

Previously, the modal only appeared when connectionState.error existed.
This meant users might be disconnected without seeing any indication if
the disconnection didn't include a specific error object.

* Real-time collaboration: Add connection status events to HTTP polling provider

Adds event emitter to HTTP polling provider to report connection
state changes. When the provider connects or disconnects, it emits
sync-connection-status events that update core-data and trigger
the disconnection modal for users.

* Real-time collaboration: Improve sync connection modal with debounce

Debounces initial modal display by 5s to prevent flicker during page
load. Updates selector to return all connection statuses and makes
onStatusChange callback mandatory for consistent error handling

* Fix the handler issue in manager

* Import BlockCanvasConver from private API

* Restore return annotation

* Fix useSelect comparison warning

* Simplify implementation to onStatusChange

* Remove getSyncErrorMessages export

* Fix type

* Fix serialize performance issue

* Fix resolver test

---------

Co-authored-by: Alec Geatches <alec.geatches@automattic.com>
Co-authored-by: ingeniumed <ingeniumed@users.noreply.github.com>
Co-authored-by: chriszarate <chris.zarate@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Package] Editor /packages/editor [Package] Sync [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants