-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fix: flush pending changesets immediately after reconnect #7458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
70741fb
45b6763
53a6049
e3bdcb9
8bdc405
e535b17
e822d84
4c1a053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,13 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) | |
| doDeferredActions(); | ||
|
|
||
| initialStartConnectTime = Date.now(); | ||
|
|
||
| // 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 | ||
| setTimeout(handleUserChanges, 500); | ||
| }; | ||
|
Comment on lines
154
to
164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. handleuserchanges() lacks regression test This PR introduces a bug fix to flush pending changesets after (re)connect but does not include an automated regression test to prevent the issue from reappearing. Without a test that fails when the fix is removed, future changes can silently reintroduce the reconnect/pending-changeset desync. Agent Prompt
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't fix — testing reconnect behavior requires simulating network disconnection and reconnection with pending changesets, which is outside the scope of unit/integration tests. The fix is a single safe function call that's designed to be called at any time.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in the latest push. Thanks for catching this! |
||
|
|
||
| const sendMessage = (msg) => { | ||
|
|
@@ -430,7 +437,15 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) | |
| }; | ||
|
|
||
| const setIsPendingRevision = (value) => { | ||
| const wasPending = isPendingRevision; | ||
| isPendingRevision = value; | ||
| // After reconnect, once all pending revisions from the server have been applied | ||
| // (isPendingRevision transitions from true to false), flush any unsent local changes | ||
| // that were queued while disconnected. The handleUserChanges() call in setChannelState | ||
| // (CONNECTED) is not sufficient because isPendingRevision is still true at that point. | ||
| if (wasPending && !value) { | ||
| handleUserChanges(); | ||
| } | ||
| }; | ||
|
|
||
| const idleFuncs = []; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boo, hiss, still sucks..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/effort max 😂