-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim #24380
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Hey @statm, thanks for this PR. I actually think this is probably not the right solution but you linked to the PR that introduced this change and I dug into why it was made in the first place. Long story short, I think we don't need all the complexity that was introduced in a93b7a2 at all. Would you mind simply making a revert of that commit and updating your PR with it? That should get rid of the |
Also please do sign the CLA :) |
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.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.
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.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.
@statm can you verify that this fixes the issue you are trying to solve and also can you sign the CLA under code.facebook.com/cla? Otherwise I can't merge this. |
@cpojer Sure! I'm currently working/waiting on 3 things:
|
Hi @cpojer, reverting a93b7a2 did fix the crash, thanks for your suggestion. We are running RN in a unit test environment, therefore have stripped out most default native modules, including
These connections will timeout after a few seconds, slowing down all tests that involve JS code. I'm considering adding a check here, like in my initial commit:
When Also - sorry about the CLA situation. It might take a little while :( |
@statm let me know once the CLA is figured out and then I can merge it :) I'd prefer to handle the issue about unit test environment that you mentioned in a separate PR if possible (this revert needs to happen either way). First though I'd like to understand which test framework you are using and whether we could shim out this setup file altogether? In general I'm hesitant to change code to make unit testing easier when you can easily mock things like this with a framework like Jest. |
@cpojer Our UTs run on a native (C++) framework, focusing on managing |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@cpojer CLA done :) |
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.
Awesome! Thanks so much for removing code :)
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.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @statm in 57c1a7a. When will my fix make it into a release? | Upcoming Releases |
Summary
setupDevtools.js
is accessingAppState.currentState
without checking its availability. In environments where 1)__DEV__ == true
, and 2) noRCTAppState
native module is provided thus resorting toMissingNativeAppStateShim
, this will result in an exception:Cannot use 'AppState' module when native 'RCTAppState' is not included in the build. Either include it, or check 'AppState'.isAvailable before calling any methods.
(Interestingly,
MissingNativeAppStateShim.currentState
did have a defaultnull
value that was later removed.)Update: Following @cpojer's suggestion of reverting a93b7a2. Title also updated to reflect this.
Changelog
[General] [Fixed] - Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim
Test Plan
No crashes in the same environments.