-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[error-recovery] Extract into unimodule #5357
Conversation
614a9ee
to
79ba500
Compare
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.
Nice work! 💪
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecovery.m
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
6dc19d6
to
fd4a8fd
Compare
fd4a8fd
to
e79ee06
Compare
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
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.
LGTM 💯
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
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.
The new code looks good. There are still some CI failures https://circleci.com/gh/expo/expo/92601 and merge conflicts that need to be fixed.
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.
Great job! Left some comments on things we still have to figure out. 💪
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.h
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.h
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
@@ -14,6 +14,7 @@ | |||
import host.exp.exponent.kernel.ExperienceId; | |||
import host.exp.exponent.storage.ExponentSharedPreferences; | |||
|
|||
// todo: Remove this once SDK34 is phased out |
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.
There's a whole bunch of code in Kernel depending on ErrorRecoveryManager
, like ReactNativeActivity#shouldShowErrorScreen
(called by BaseExperienceActivity#consumeErrorQueue
(called byBaseExperienceActivity.addError
…))
and Updates
depending on app.json#updates.checkAutomatically === 'ON_ERROR_RECOVERY'
if (experienceMetadata != null && experienceMetadata.optBoolean(ExponentSharedPreferences.EXPERIENCE_METADATA_LOADING_ERROR)) { |
Maybe we should annotate that code too with a clear strategy on how to deprecate it? Currently I don't see any support kept for ON_ERROR_RECOVERY
setting for Updates. How do you handle it in expo-ota
PR, @mczernek?
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.
I've tried to read and understood ErrorRecoveryManager
code.
Here is what this class does:
- Android
- owns recovery props
- has
shouldReloadOnError
methods, which indicate if experience should reload after the crash (for me it's a little bit strange because this method depends on the time between app loading and crashing).
- iOS
- associates arbitrary developer info with experience id (we don't use this)
- knows if auto-reload after an error is possible
- tracks state of experience (
is recovering, has errors, last loaded
) - knows if error screen should be shown
Imho, we should leave most of this class. However, maybe renaming will be good options.
This class has more common with error handling than with error recovering.
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.
So to sum up, ErrorRecoveryManager
's responsibilities are:
- recovery props memory — moved to native module
- knows whether to show error screen based on timing of crashes/successful loads — this can stay even longer than when SDK34 is phased out, we may want to leave this feature. Moreover, it is independent from the recovery props memory responsibility
- informs other pieces of the infrastructure (
Updates
) that the experience is erroring — this, fortunately, is also independent from the recovery props memory responsibility.
ErrorRecoveryManager
doesn't need to be removed, it can stay as a part of ExpoKit. We just removed the memory responbility. 🙂
4001caf
to
94b6f44
Compare
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.h
Outdated
Show resolved
Hide resolved
9fa2ae0
to
4d61725
Compare
4d61725
to
ccde2c7
Compare
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
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.
I've looked at ErrorRecoveryManagers
again and here's what I found
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
packages/expo-error-recovery/ios/EXErrorRecovery/EXErrorRecoveryModule.m
Show resolved
Hide resolved
@@ -14,6 +14,7 @@ | |||
import host.exp.exponent.kernel.ExperienceId; | |||
import host.exp.exponent.storage.ExponentSharedPreferences; | |||
|
|||
// todo: Remove this once SDK34 is phased out |
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.
So to sum up, ErrorRecoveryManager
's responsibilities are:
- recovery props memory — moved to native module
- knows whether to show error screen based on timing of crashes/successful loads — this can stay even longer than when SDK34 is phased out, we may want to leave this feature. Moreover, it is independent from the recovery props memory responsibility
- informs other pieces of the infrastructure (
Updates
) that the experience is erroring — this, fortunately, is also independent from the recovery props memory responsibility.
ErrorRecoveryManager
doesn't need to be removed, it can stay as a part of ExpoKit. We just removed the memory responbility. 🙂
75355c4
to
9a9b3b1
Compare
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.
A couple of comments, apart from them — it's ready when it comes to my review!
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
ios/Exponent/Versioned/Core/UniversalModules/EXScopedErrorRecoveryModule.m
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
...iew/src/main/java/versioned/host/exp/exponent/modules/universal/ScopedErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
.../expo-error-recovery/android/src/main/java/expo/modules/errorrecovery/ErrorRecoveryModule.kt
Outdated
Show resolved
Hide resolved
11528ea
to
3c6eee2
Compare
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.
Great work! 👏 The only thing left is for @EvanBacon to respond to https://github.com/expo/expo/pull/5357/files#r327406072. 🙂 Otherwise it should be good to merge!
3c6eee2
to
846d899
Compare
846d899
to
7843c53
Compare
Why
Resolve #5256.
Test Plan
I've tested it with simple demo https://snack.expo.io/@lukaszkosmaty/error-recovery-test.
I've also tested scoped behaviour.