Repository navigation
fix(web): suppress false offline errors and refetch data on tab resume - #787
Merged
evilguy4000 merged 1 commit intoOct 16, 2026
Merged
Conversation
After a tab sat in the background for a long time, returning to it fired a burst of requests on stale keep-alive connections (ERR_CONNECTION_CLOSED / 503 from the proxy), and the one-shot health check declared the server offline even though it was healthy. - Add an 8s resume grace window that suppresses connectivity toasts while the reconnect burst settles (callers still receive the error responses) - Replace the single /api/health probe on visibilitychange with up to 3 backoff probes (0s/2s/5s) before showing the offline banner - Dispatch a debounced tt:tab-resumed event; floating timer bar and smart notifications refetch authoritative data on it - Floating timer bar retries a failed status fetch once (network errors surface as synthetic 503 responses via the fetch interceptor)
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.
Problem
After a browser tab sat in the background for a while (e.g. during lunch), returning to it showed "Unable to connect to the server" even though the server was healthy. Console showed a burst of
ERR_CONNECTION_CLOSEDand proxy 503/504s on/socket.io/,/api/health,/timer/status,/api/notifications.Cause: while backgrounded, the browser suspends JS timers and the proxy eventually closes the idle keep-alive/long-poll connections. On resume, the tab fires a burst of requests; several land on dead keep-alive sockets (network errors) and the rest hit the reconnect burst. The one-shot
/api/healthprobe onvisibilitychangefailed during that window, so the client declared the server offline and showed the offline banner — then recovered on its own seconds later.Fix (frontend only)
error-handling-enhanced.js:/api/healthprobe on resume is replaced by up to 3 backoff probes (0s/2s/5s) before declaring the server offline; success at any point dismisses existing connectivity errors (existing behavior preserved).tt:tab-resumedevent: single debounced (1.5s) document event on tab resume.floating-timer-bar.js:tt:tab-resumedsmart-notifications.js: polls/api/notificationsontt:tab-resumed.Testing
node --checkpasses on all touched filestests/test_reconnect_on_resume.py: the updated guard for the resume logic passes; the 3 other failures in that file (service worker / chat widget / retry-button assertions from Error Service temporarily unavailable. Please try again in a few moments. #746) fail identically ondevelopat baseline and are untouched by this PRRelated: #702, #703, #746