There are 5 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-2466329f-f18b-4cd6-b2f8-63bf8f4ae005 XWIKI-25435 Closed

Changes made while disconnected from a BlockNote realtime editing session are lost when reconnecting

 
View issue   ยท   Add comment
 

5 updates

 
cid:jira-generated-image-avatar-0fb91e88-b6ca-4f28-8378-d14b50113a56 Changes by Marius Dumitru Florea on 21/Oct/26 20:20
 
Documentation in Release Notes: N/A
Documentation: N/A
Resolution: Fixed
Tests: Unit,Integration
Status: Open Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-0fb91e88-b6ca-4f28-8378-d14b50113a56 Marius Dumitru Florea on 21/Oct/26 20:17
 

Fixed by https://github.com/xwiki/xwiki-platform/pull/7071 (master: f16f5dde3b0, stable-18.9.x: d655095fff9).

Cause

On (re)connect the Yjs WebSocket provider sends only a sync step 1 and relies on the server to send back its own sync step 1, asking for the updates it misses. The XWiki Yjs WebSocket endpoint doesn't hold a Yjs document, only the updates it received: it replays them, followed by an empty sync step 2, but never asks the client for anything. So the changes made while disconnected, as well as the ones sent into a connection that was already lost (up to 30 seconds before the loss is detected), never reached the other editors.

Fix

  • The client now holds back the history replayed by the server on (re)connect, applies it in a single transaction, computes from it what the server has and sends back what the server misses: the changes made while disconnected or lost with the connection, including delete-only changes.
  • The client also checks, before touching its document, whether the room was replaced while it was disconnected:
    • if the room is empty (everyone left), the client pushes its full state and the session continues;
    • if someone started a new session from the saved page meanwhile, merging would duplicate the whole content, so the editor stops synchronizing (it stays disconnected), keeps the local changes and shows a warning on the realtime toolbar explaining that the changes are not shared anymore.
  • The realtime toolbar can now display warnings (an icon showing the message in a popover), through a generic API that other realtime editors can use.

Limitations / follow-ups

  • When the session was replaced, the local changes are kept but not merged into the new session: the user has to copy them and reload the editor. Reconciling them automatically, or avoiding the problem by persisting the Yjs document of each page (so that a new session continues the previous one), is left for follow-up issues.
  • A client that edited since its last synchronization re-sends its delete set (idempotent, usually small) each time it reconnects.

Tests

  • New unit tests running the real Yjs WebSocket provider against a fake room mimicking the XWiki endpoint (offline insert, offline delete, update lost with the connection, reconnect without changes, room discarded, room replaced), plus tests for the toolbar warnings.
  • BlockNote CollaborationIT passes (11/11).