fix(mobile): delay the offline banner by 5s, hide it at once - #5139
Merged
Conversation
NetInfo reports a false offline for a moment after a long background. The 1s symmetric debounce was shorter than that window, so the banner flashed on every foreground. Show waits 5s. Hide is immediate: a banner that is up while the connection works is the worse error.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the asymmetric offline-banner debounce (5s show delay, immediate hide) across the store, banner component, and both updated test suites; the state machine handles all transition paths correctly (pending-cancel on recovery, immediate online commit, destroy-time cancellation) with no timer, listener, or subscription leaks introduced. Files Reviewed (4 files)
Reviewed by kimi-k3 · Input: 4.3K · Output: 868 · Cached: 101K Review guidance: REVIEW.md from base branch |
jeanduplessis
approved these changes
Aug 7, 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.
Problem
After a long background, the app foregrounds and the offline banner flashes for a moment before it goes away. NetInfo reports a false
offlineright after resume, and the banner's debounce was shorter than that window.Change
src/lib/offline-banner-state.tsused one symmetric 1 s debounce for both directions. It now splits them:No AppState listener. The bogus event lands after the app is already active, so a plain delay covers it.
Scope
query-client-lifecycle.tsxanduser-web-connection-lifecycle.tsread the same NetInfo events and stay undebounced. React Query pausing for a second is invisible and correct.Trade-off
A real disconnect is reported up to 5 s late. Failed requests still surface their own errors. A cold start while offline shows the banner 5 s in, not 1 s.
Checks
pnpm format && pnpm typecheck && pnpm lint && pnpm check:unusedpass.pnpm test: 3906 tests pass. Unit tests only — the simulator cannot reproduce iOS suspension with stale NetInfo.