fix(web): prefer live Hub connectivity over navigator status#1051
fix(web): prefer live Hub connectivity over navigator status#1051Aqi77su wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Findings
- [Minor] Keep offline suppression aligned with the visible reconnect banner —
OfflineBannernow suppresses itself for rawsseDisconnected, butReconnectingBanneronly renders forsseDisconnected && !isSyncing. During an SSE disconnect whileisSyncingis true andnavigator.onLineis false,SyncingBanneris also hidden by the online check, so all connection banners disappear until syncing clears. Evidence:web/src/App.tsx:450.
Suggested fix:const showReconnectingBanner = sseDisconnected && !isSyncing <PwaUpdateBannerWithStatusOffset isSyncing={isSyncing} isReconnecting={showReconnectingBanner} /> <ReconnectingBanner isReconnecting={showReconnectingBanner} reason={sseDisconnectReason} /> <OfflineBanner isHubConnected={globalSubscriptionId !== null} isReconnecting={showReconnectingBanner} />
Summary
- Review mode: initial
- One banner-precedence edge case found in the App wiring.
Testing
- Not run (automation; static review only).
HAPI Bot
| <OfflineBanner /> | ||
| <OfflineBanner | ||
| isHubConnected={globalSubscriptionId !== null} | ||
| isReconnecting={sseDisconnected} |
There was a problem hiding this comment.
[Minor] OfflineBanner now suppresses itself for raw sseDisconnected, but the reconnecting banner is only visible for sseDisconnected && !isSyncing. If an SSE disconnect happens while sync is active and navigator.onLine is false, SyncingBanner is hidden by its online check, ReconnectingBanner is hidden by isSyncing, and this banner is hidden by sseDisconnected, leaving no connection banner until sync clears.
Suggested fix:
const showReconnectingBanner = sseDisconnected && !isSyncing
<OfflineBanner
isHubConnected={globalSubscriptionId !== null}
isReconnecting={showReconnectingBanner}
/>|
Addressed the banner-precedence finding in 452e4c4. |
There was a problem hiding this comment.
Findings
- [Major] Wrap the new banner tests in the i18n provider — both added test files render components that call
useTranslation(), and that hook throws unless anI18nProvideris in the React tree. As written, the firstrender(<OfflineBanner ... />)fails before the assertion runs, andReconnectingBanner.test.tsxhas the same setup issue. Evidence:web/src/components/OfflineBanner.test.tsx:17andweb/src/components/ReconnectingBanner.test.tsx:6.
Suggested fix:import { I18nProvider } from '@/lib/i18n-context' render( <I18nProvider> <OfflineBanner isHubConnected={false} isReconnecting={false} /> </I18nProvider>, )
Summary
- Review mode: follow-up after new commits
- The follow-up commit fixed the prior banner-precedence concern, but the added component tests need the same i18n wrapper used by existing web component tests.
Testing
- Not run (automation; local
bunis unavailable in this runner:/bin/bash: line 1: bun: command not found).
HAPI Bot
| }) | ||
|
|
||
| it('shows when the browser and hub are offline', () => { | ||
| useOnlineStatusMock.mockReturnValue(false) |
There was a problem hiding this comment.
[Major] This render path is missing I18nProvider. OfflineBanner calls useTranslation(), and that hook throws when there is no provider, so this test fails before reaching the assertion. ReconnectingBanner.test.tsx has the same issue at its first render.
Suggested fix:
import { I18nProvider } from '@/lib/i18n-context'
render(
<I18nProvider>
<OfflineBanner isHubConnected={false} isReconnecting={false} />
</I18nProvider>,
)|
Addressed the follow-up test failure in 9f2e50d. Both banner test suites now render their components inside the repository's |
There was a problem hiding this comment.
Findings
- No issues found.
Summary
- Review mode: follow-up after new commits
- Full diff reviewed. The prior i18n-provider test failure is fixed in the latest head. Residual risk is limited to runtime SSE/browser connectivity behavior that is not covered by an App-level integration test.
Testing
- Not run (automation; review policy avoids executing PR code).
HAPI Bot
Summary
navigator.onLineis falseCloses #1050.
Rationale
navigator.onLineis only a browser hint and can remain false with working proxy, VPN/TUN, embedded-browser, or platform networking. A live Hub SSE subscription is stronger evidence of connectivity and should take precedence.Testing
OfflineBannerandReconnectingBanner.AI disclosure
Implementation and tests were produced with OpenAI Codex (GPT-5) and manually scoped against the existing Hub/SSE state flow.