Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating check to only set status as online if we're sure we're online #38409

Merged
merged 1 commit into from
Mar 15, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/libs/NetworkConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Onyx.connect({
setOfflineStatus(true);
} else {
// If we are no longer forcing offline fetch the NetInfo to set isOffline appropriately
NetInfo.fetch().then((state) => setOfflineStatus(state.isInternetReachable === false));
NetInfo.fetch().then((state) => setOfflineStatus((state.isInternetReachable ?? false) === false));
Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively we could do this I assume, but either works

Suggested change
NetInfo.fetch().then((state) => setOfflineStatus((state.isInternetReachable ?? false) === false));
NetInfo.fetch().then((state) => setOfflineStatus(state.isInternetReachable !== true));

}
},
});
Expand Down Expand Up @@ -106,7 +106,7 @@ function subscribeToNetInfo(): void {
Log.info('[NetworkConnection] Not setting offline status because shouldForceOffline = true');
return;
}
setOfflineStatus(state.isInternetReachable === false);
setOfflineStatus((state.isInternetReachable ?? false) === false);
});
}

Expand Down
Loading