client: nudge sync on tab/PWA resume (retryImmediately + one stop/start fallback) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "void/resume-sync"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
startClientpassed onlylazyLoadMembersand nothing listened for visibilitychange/pageshow/online, so a dead sync long-poll waited out its ~30 s timeout after a backgrounded tab/PWA.New
src/client/resumeSync.ts, started once afterstartClient: on visible (only if hidden >= 5 s),pageshowwithpersisted, andonline, debounced 250 ms, callmx.retryImmediately(). If sync state is not PREPARED/SYNCING/CATCHUP 3 s later, onestopClient+ restart, never overlapping with itself. Returns a disposer that removes listeners and timers.Verified: vitest
src/client7/7 (mocked client, fake timers).tsc --noEmit765 errors, same as base; none added.Not verified: nothing was timed on a phone or in a real browser; the 3 s/5 s/250 ms constants are untuned guesses. SyncState is compared as strings because matrix-js-sdk's type imports are already broken in this tree's tsc baseline. A healthy-looking but stale SYNCING state right after resume is trusted after the nudge.
No merge, no deploy.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.