-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Updating check to only set status as online if we're sure we're online #38409
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
Conversation
…se so we don't schedule several reconnects
|
No need for a C+ review on this one. |
Reviewer Checklist
Screenshots/VideosStraight forward logic change Android: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
mountiny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| } 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)); |
There was a problem hiding this comment.
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
| NetInfo.fetch().then((state) => setOfflineStatus((state.isInternetReachable ?? false) === false)); | |
| NetInfo.fetch().then((state) => setOfflineStatus(state.isInternetReachable !== true)); |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.54-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.4.54-4 🚀
|
Details
Since
isInternetReachablecan be returned asnullif current state is unknown, we're considering that as if we're online. Through the logs, it was possible to check that this triggers several ReconnectApps/ReconnectToReport while the app is still trying to understand if it's online or not. Let's explicitly say that we're not online until we have a state saying otherwise.Log 1 and Log 2 - search for
Firing reconnection callbacks because. You'll see that the line just before it hasisInternetReachable: '', so the device was not connected to the internet when we scheduled a ReconnectApp request. That is happening for all requests that we call once we are reconnect.Fixed Issues
$ #38160
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop