There are 5 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-e8c193cd-5755-4e9b-946a-f4e17574b85b XWIKI-24387 Closed

BlockNote editor fails to load if it cannot connect to the collaboration WebSocket

 
View issue   ยท   Add comment
 

5 updates

 
cid:jira-generated-image-avatar-50f53634-044a-4377-9d6c-f2b348270125 Changes by Marius Dumitru Florea on 21/Oct/26 23:44
 
Documentation in Release Notes: N/A
Documentation: N/A
Resolution: Fixed
Tests: Unit,Integration
Status: In Progress Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-50f53634-044a-4377-9d6c-f2b348270125 Marius Dumitru Florea on 21/Oct/26 23:37
 

Fixed by https://github.com/xwiki/xwiki-platform/pull/7105 (stable-18.9.x: ad2d2e49e66, master: 6004cc78ef1). It replaces https://github.com/xwiki/xwiki-platform/pull/6773, which was written before the realtime toolbar (XWIKI-24373). Nicoleta is credited as co-author.

Cause

Joining the realtime collaboration session waited for the initial synchronization with no timeout. The Yjs WebSocket provider retries the connection forever, because our end-point closes with codes it treats as retriable. So when the connection couldn't be established, the editor was never displayed, and the realtime toolbar wasn't created. In-place, the edit mode was entered with an empty content area. A join that failed with an error (e.g. the current user details couldn't be retrieved) also stayed cached, so the editor couldn't join again on the same page.

Fix

A connection that can't be established is now handled like a connection lost in the middle of a realtime session:

  • The editor stops waiting for the initial synchronization when no connection is established within 5 seconds, and joins the realtime session disconnected. The editor is displayed and the realtime toolbar shows "Disconnected". No notification is displayed, since the toolbar already shows the connection status.
    • While a connection is established but the server history is still being received, it keeps waiting. Initializing the content locally at that point would conflict with the session it's about to join.
  • The user can edit and save while disconnected, because saving doesn't depend on the collaboration server:
    • Done and Summarize & Done stay enabled, and the Save & Continue shortcut key works.
    • The content is auto-saved.
    • The created revisions are listed in the versions dropdown.
    • This applies only to BlockNote. The CKEditor and wiki realtime editors still disable saving while disconnected, because they become read-only.
  • The editor keeps trying to connect in the background. Once connected (thanks to XWIKI-25435):
    • if no one else is editing, the local content and changes are shared and the realtime session continues;
    • if someone else started editing the page meanwhile, the synchronization is stopped and the toolbar warns that the changes are not shared anymore, instead of duplicating the content.
  • A failed join is no longer cached, so joining again retries. If the collaboration session can't be created at all, the editor is displayed without realtime collaboration.

Limitations

  • A version saved while disconnected is not announced to the other users editing the page, so their next save may hit a merge conflict.
  • If someone else started editing the page before the connection was established, the local changes are kept but not merged into their session (same limitation as XWIKI-25435).
  • When WebSockets can't work at all (e.g. behind a proxy without WebSocket support), the editor keeps retrying (every 2.5 seconds at most) for the whole editing session, as it does after a connection loss.

Tests

  • Unit tests for the connection timeout, the auto-save start while disconnected, the join retry and the toolbar save actions. There are also three new reconnect scenarios against a fake room mimicking the XWiki end-point:
    • an empty room;
    • a session started by someone else before we initialized the content;
    • a session started by someone else after we did.
  • New functional test CollaborationIT#editWhileCollaborationServerIsUnreachable:
    • Loading the editor with the collaboration server unreachable.
    • Saving while disconnected, with the revision listed in the versions dropdown.
    • Reconnecting, after which a second user sees the changes and both users see each other.
    • The whole CollaborationIT passes (12/12).