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
feat: reachability test may be enabled/disabled via user-supplied function #513
feat: reachability test may be enabled/disabled via user-supplied function #513
Conversation
Co-authored-by: wholesomewilson <wilsonwan88@gmail.com>
Co-authored-by: wholesomewilson <wholesomewilson@users.noreply.github.com>
Co-authored-by: wholesomewilson <wilsonwan88@gmail.com>
Co-authored-by: wholesomewilson <wilsonwan88@gmail.com>
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.
This looks really fantastic to me. I had a couple comments I'm curious for the answers on but as I'm sure you see them, they're nitpicks vs the general idea and general level of the PR. Thanks for contributing this!
Co-authored-by: wholesomewilson <wilsonwan88@gmail.com>
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.
The doc update looks great, I don't see a reason not to merge this, so here we go :-) - thanks!
This may have a testing issue, I had to cancel the previous run:
Note the timestamps, it was sitting for 18 minutes where normally it's almost immediate |
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.
Unfortunately I can't merge this yet - there is some interaction between the new test code and jest where something is not resolving, so the tests hang. This is not present on HEAD of default branch so it must be this PR somehow. Can you investigate? It looks so ready to go, too! 😩
https://github.com/react-native-netinfo/react-native-netinfo/runs/4117704891?check_suite_focus=true
I think I have found the issue. It was the setTimeout in |
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.
It appears to be a thing of beauty now! ⚡
# [6.1.0](v6.0.6...v6.1.0) (2021-11-07) ### Features * reachability test may be enabled/disabled via user-supplied function ([#513](#513)) ([83c1e0d](83c1e0d))
🎉 This PR is included in version 6.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
There are multiple requests to disable internet reachability check. The proposed solution is to add a
reachabilityShouldRun
option toconfigure
. This new option accepts a function that returns a boolean. This boolean flag will be used in the_setExpectsConnection
function to determine whether_checkInternetReachability
should be called.Proposed Solution Reference: #178 (comment)
Test Plan
New set of unit tests are added to check if
reachabilityShouldRun
option is working correctly in bothNetInfo.addEventListener
andNetInfo.fetch
.Fixes: #178 #380 #440