mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-05-04 19:56:37 +02:00
fix: defer handleUserChanges on connect to avoid editor init race
Calling handleUserChanges() synchronously in setUpSocket() caused "Cannot read properties of null (reading 'changeset')" because the editor isn't fully initialized on first connect. Deferred with setTimeout(500ms) to allow initialization to complete. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
09d81c01a7
commit
d6a4497015
@ -155,11 +155,12 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||
|
||||
initialStartConnectTime = Date.now();
|
||||
|
||||
// Flush any pending local changes immediately after (re)connect.
|
||||
// Flush any pending local changes after (re)connect.
|
||||
// Without this, changes made while disconnected are not sent to the
|
||||
// server until the user makes another edit.
|
||||
// Deferred to allow the editor to finish initialization on first connect.
|
||||
// See https://github.com/ether/etherpad-lite/issues/5108
|
||||
handleUserChanges();
|
||||
setTimeout(handleUserChanges, 500);
|
||||
};
|
||||
|
||||
const sendMessage = (msg) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user