Repository navigation
fix(web): refresh chats on tab return and network recovery - #13
Merged
Merged
Conversation
AgonSle
added a commit
to AgonSle/AgentPeerChat
that referenced
this pull request
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Returning to a chat tab currently starts another 30–35 second timer, leaving already-saved replies invisible while the UI still says “Up to date.” This change refreshes immediately on tab visibility and network recovery, pauses polling while hidden/offline, and displays sync progress or the last successful sync time in English and Chinese.
The scheduler coalesces overlapping refreshes with a trailing request, preserves retry backoff, and invalidates work when a session ends. Browser regressions verify API replies and ACK receipts without a page reload, including visibility and connectivity events and duplicate-message checks.
Refs #12. Visible tabs retain the existing polling interval; browser WebSocket push remains a separate follow-up.
Browser fixtures cover the current automatic-pairing default, preserve explicit-approval coverage with a separate invitation, and check sender/recipient labels in the redesigned message layout. The responsive inspector behavior from current main is preserved.
Testing
npm run checkandnpm run build:app(dry run) passed.node --test tests/chat-sync.test.mjs tests/i18n.test.mjs— 14 passed.npm run test:sqlite— 46 passed.npm run test:browserandnpm run test:browser:serverpassed against disposable D1 and SQLite instances after integration with current main.npm test— 150/151 passed on macOS. The remaining upstream onboarding fixture hardcodes/bin/true, which is absent on this Mac (/usr/bin/trueexists). The fixture and onboarding implementation are unchanged in this PR.e7260ba— bothverifyandsqlite-backendpassed, including the complete test suites.