From 09d81c01a763550ec137ca7182c493f232972ce5 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 4 Apr 2026 19:06:05 +0100 Subject: [PATCH] fix: flush pending changesets immediately after reconnect After reconnecting, setUpSocket() did not call handleUserChanges(), so any edits made while disconnected were not sent to the server until the user made another change. This caused divergent pad state between users. Now calls handleUserChanges() after reconnect to immediately transmit any pending local changesets. Fixes #5108 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/static/js/collab_client.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/static/js/collab_client.ts b/src/static/js/collab_client.ts index 7bc1c37df..62cfdabf1 100644 --- a/src/static/js/collab_client.ts +++ b/src/static/js/collab_client.ts @@ -154,6 +154,12 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) doDeferredActions(); initialStartConnectTime = Date.now(); + + // Flush any pending local changes immediately after (re)connect. + // Without this, changes made while disconnected are not sent to the + // server until the user makes another edit. + // See https://github.com/ether/etherpad-lite/issues/5108 + handleUserChanges(); }; const sendMessage = (msg) => {