-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[updates] fix error recovery on android #27815
Conversation
The Pull Request introduced fingerprint changes against the base commit: 796d42a Fingerprint diff[
{
"type": "dir",
"filePath": "../../packages/expo-modules-core/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "de8d3310de13d9a5605e3879286bb29fd04443eb"
},
{
"type": "dir",
"filePath": "../../packages/expo-updates/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "d1e2a67bbf7990d98ba4b62369007d725ac32645"
},
{
"type": "dir",
"filePath": "../../packages/expo/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "dde693a1c8cad65bef7da0050bcd720f99343ed1"
}
] Generated by PR labeler 🤖 |
82ad034
to
3f20d49
Compare
3f20d49
to
8eff6d1
Compare
the sdk check-packages failure would be fixed by #27891 |
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.
Main change is to add asserts for our assumptions about code we expect to only run in bridgeless and code we expect to never run in bridgeless.
...dates/android/src/main/java/expo/modules/updates/procedures/RecreateReactContextProcedure.kt
Outdated
Show resolved
Hide resolved
...ages/expo-updates/android/src/main/java/expo/modules/updates/procedures/RelaunchProcedure.kt
Outdated
Show resolved
Hide resolved
@@ -245,6 +245,10 @@ class StartupProcedure( | |||
errorRecovery.startMonitoring(reactContext) | |||
} | |||
|
|||
fun onReactInstanceException(exception: Exception) { | |||
errorRecovery.handleException(exception) |
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.
since overriding the exception handler doesn't work on bridgeless, should we update ErrorRecovery to not register the error when in bridgeless mode?
edit: I see that the registration is done in onDidCreateReactInstanceManager
/onDidCreateReactInstance
so it shouldn't be running on bridgeless. let's add an assert to registerErrorHandler
to assert non-bridgeless and also add an assert to onReactInstanceException
(here) to assert bridgeless, just so that if upstream (expo-modules-core) is changed our assumptions hold.
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.
tried to split that as two different implementation, hopes that looks good
private fun registerErrorHandler(reactContext: ReactContext) {
if (ReactFeatureFlags.enableBridgelessArchitecture) {
registerErrorHandlerImplBridgeless(reactContext)
} else {
registerErrorHandlerImplBridge(reactContext)
}
}
...-modules-core/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java
Outdated
Show resolved
Hide resolved
...-modules-core/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Will Schurman <wschurman@expo.io> Co-authored-by: Douglas Lowder <douglowder@mac.com>
8eff6d1
to
16526fd
Compare
Why
add bridgeless support for expo-updates's error recovery on android
close ENG-11707
How
DefaultJSExceptionHandler
from DevSupportManager doesn't work on bridgeless mode. we should add aReactNativeHostHandler.onReactInstanceException
to pull the exception from ReactHostReactApplication.restart()
to support both bridgeless and bridge mode.Test Plan
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).