-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Fix Unable to find module for UIManager issue #26861
Conversation
rather than change the module loading logic, I would change uiManager's getter here: https://github.com/facebook/react-native/blob/master/React/Modules/RCTUIManager.m#L1616 that seems to make more sense as it looks like the dealloc is throwing the error |
Is having an early exit when |
yes. you're essentially checking to see if RCTUIManager has been invalidated and if so skip some checks. But we can instead harden when the RCTUIManager is accessed off RCTCxxBridge
yea I definitely agree that we do not want to show a redbox in this case but I think that we should solve the problem a different way. |
@mmmulani Okay. Unfortunately I have no C++ experience, so I'm not sure what the alternative solution would look like. If it's a simple change would you be willing to open a PR and I'll close this one in favor of it? |
Just helping document the issue, on the project I use it happens every time in the scenario @kevinvangelder described. |
I'm curious if @mhorowitz has any thoughts for us. |
Any update on this? |
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
Summary
A race condition sometimes causes redbox errors when reloading the app after previously opening the Chrome debugger. In the project I was working on, we were regularly getting
Unable to find module for UIManager
and I was able to track it down to_moduleDataByName
sometimes being empty or nil. This change safely early-exits when that is the case and the app loads successfully. Related issues:#24549
#23235
Changelog
[iOS] [Fixed] - Race condition causing redbox errors when reloading app after using Chrome debugger
Test Plan
As this is a difficult-to-reproduce race condition, I'm not entirely certain what the test plan should be. I created this change as a patch to React Native in the closed-source project I've been working on and it works flawlessly, however I haven't been able to reproduce the issue in a clean project. This is a fairly safe change as the early exit only ever occurs if the variable is empty and it seems to be resilient enough to load the module again after the race condition has been defeated, but I'm open to suggestions on potential options to test this.