mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Reset ReactInstanceManager state on failure to allow retries (#32901)
Summary: This fixes https://github.com/facebook/react-native/issues/32898 by reseting ReactInstanceManager state when `createReactContext` throws. By resetting the state, we allow future attempts at creating the React context. ## Changelog [Android] [Fixed] - Fixed empty screen after retrying a BundleDownloader failure in dev mode Pull Request resolved: https://github.com/facebook/react-native/pull/32901 Test Plan: Go through the steps to reproduce listed in https://github.com/facebook/react-native/issues/32898 and see that the React Native application starts. Reviewed By: cortinico Differential Revision: D33634178 Pulled By: ShikaSD fbshipit-source-id: e54d12d5f33c9c7c0ca213113871b88c2f1dc261
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3addafa525
commit
c8d823b9bd
@@ -1103,14 +1103,22 @@ public class ReactInstanceManager {
|
||||
// create
|
||||
mHasStartedCreatingInitialContext = true;
|
||||
|
||||
final ReactApplicationContext reactApplicationContext;
|
||||
try {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);
|
||||
ReactMarker.logMarker(VM_INIT);
|
||||
final ReactApplicationContext reactApplicationContext =
|
||||
reactApplicationContext =
|
||||
createReactContext(
|
||||
initParams.getJsExecutorFactory().create(),
|
||||
initParams.getJsBundleLoader());
|
||||
|
||||
} catch (Exception e) {
|
||||
// Reset state and bail out. This lets us try again later.
|
||||
mHasStartedCreatingInitialContext = false;
|
||||
mCreateReactContextThread = null;
|
||||
mDevSupportManager.handleException(e);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mCreateReactContextThread = null;
|
||||
ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_START);
|
||||
final Runnable maybeRecreateReactContextRunnable =
|
||||
|
||||
Reference in New Issue
Block a user