Grab RCTPerfMonitor's devSettings from the bridge #1426
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
We've seen an issue on iOS when doing remote web debugging while using integrated RN with a custom
RCTDevSettingsDataSource
that doesn't persist globally (unlike the default which usesNSUserSettings
), a scenario useful when simultaneously running multiple RN instances with different dev settings.When we reload the bridge upon establishing a remote debugging connection, we reinitialize all our modules. On iOS this includes
PerfMonitor
, which depends onDevSettings
, which attempts to load the current values using the defaultNSUserSettings
-based dev settings when it gets reinitialized. However, since the original custom data source is designed to keep dev settings compartmentalized to particular RN instances, our "global defaults" that we load upon initialization have a different value. This causes the bridge to reload once again, resulting in an infinite loop.The fix here is to use the bridge's already established
devSettings
so we ensure we're using our local dev settings instead of trying to default to global ones.Changelog
[iOS] [Fixed] - Fix issue with custom non-persistent
RCTDevSettingsDataSource
Test Plan
Validated that this fixes the original issue while keeping remote debugging in RNTester okay. Initial tests show that for
RCTPerfMonitor
,[self->_moduleRegistry moduleForName:"DevSettings"]
and[[self bridge] devSettings]
return the same value, so this shouldn't affect the remote debugging process in other cases.