-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Always listen for Network Connection for Offline Indictor #11672
Conversation
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.
Solution makes sense to me, but should we update subscribeToNetInfo()
method to not attach listener if one already exists? or clear previous one? Looks like this was the only place where we're clearing the listeners.
@MonilBhavsar That's a good point and I think I agree- but since we plan on always listening for network info whether or not the user is signed on, I'm not sure when we should clear them. They're currently initialized here when the App is built, and I thought that event listeners were removed when an App is killed, so is there a way for duplicate listeners to be created with this set up? |
@yuwenmemon @marcaaron Tagging since you worked on this flow in the past, do you have any suggestions for a better way to subscribe/clear the network info listeners for the offline indicator outside of signing off? |
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.
Looks good to me! I'll approve once you complete the checklist. suggestion: keep your PRs as drafts until you complete the checklist.
If we don't have any reason to disconnect the subscribers can we also remove the methods here: App/src/libs/NetworkConnection.js Lines 84 to 97 in d99d7c8
|
This is true since the JS is not running anymore and would need to be evaluated again when the user reopens the app. I think the same would be true if they are returning from background, but probably something we can test.
I don't think so, but it should be testable. Definitely not possible on web/desktop - not 100% sure about native or if we could see a memory leak there, but guessing the answer is no. |
806098e
to
eab30a1
Compare
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.
You have some lint errors in NetworkConnection.js due to unused variable / exports. All you need to do is delete them.
@AndrewGable do you have any idea why the PR review checklist test isn't passing here? |
It might have changed since you opened the PR, can you double check you are using the latest one? |
👀 I'm reviewing again and I'll work on the reviewer checklist. For some reason it's not part of the checks but it should be done anyways. |
I think it would be good to add some screenshots for steps 4-6, because I'm not sure if QA knows how to open dev tools and change the Network conditions. They might know, but it's best to spell it out. |
Let's also make the QA steps for Web and Desktop only because as far as I know those are the only platforms where you can open devtools (use command + option + i). |
|
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.
Good to go! I used force offline to test on iOS, but it's really kind of irrelevant to the changes here. At least it proved that iOS and Safari platforms still run properly.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @neil-marcellini in version: 1.2.18-0 🚀
|
🚀 Deployed to staging by @neil-marcellini in version: 1.2.18-0 🚀
|
🚀 Deployed to production by @chiragsalian in version: 1.2.18-10 🚀
|
Details
The offline indicator stopped working after signout/signing back in.
Also fixes the resulting issue that signing off while offline would require a refresh in order to sign back on.
This fix means that the App will always listen for network connection. More discussion in the linked issue!
Fixed Issues
$ #10524
Tests
Tests performed locally:
PR Review Checklist
PR Author Checklist
PR Author Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
Mobile Web - Chrome
Mobile Web - Safari

note: used force offline, so ignore iphone wifi iconDesktop
iOS

note: used force offline, so ignore iphone wifi iconAndroid