Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/libs/NetworkConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ function subscribeToNetInfo(accountID: number | undefined): () => void {
Log.info('[NetworkConnection] Not setting offline status because shouldForceOffline = true');
return;
}
// On web, navigator.onLine is a cheap browser-level signal that the
// network adapter is connected. When NetInfo's Ping-based reachability
// check fails (e.g. due to contention with a large upload) but the
// browser still reports online, it's likely a false positive — skip
// setting offline. This particularly helps Safari which lacks the
// Network Information API and can't self-correct via connection events.
if (state.isInternetReachable === false && typeof navigator !== 'undefined' && navigator.onLine) {
Log.info('[NetworkConnection] NetInfo says unreachable but navigator.onLine is true — skipping offline to avoid false positive');
return;
Comment on lines +301 to +303

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep server-outage offline updates despite navigator guard

This early return bypasses the existing setOfflineStatus(state.isInternetReachable === false || !isServerUp, ...) path whenever navigator.onLine is true, so a backend outage (where reachabilityTest sets isServerUp = false but the browser still reports online) will no longer mark the app offline. In that scenario users stay in an online state while API calls fail, which is a regression introduced by this guard.

Useful? React with 👍 / 👎.

}
setOfflineStatus(state.isInternetReachable === false || !isServerUp, 'NetInfo received a state change event');
Log.info(`[NetworkStatus] NetInfo.addEventListener event coming, setting "offlineStatus" to ${!!state.isInternetReachable} with network state: ${JSON.stringify(state)}`);
let networkStatus;
Expand Down
Loading