-
Notifications
You must be signed in to change notification settings - Fork 58
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
CPLAT-8600: Unrecoverable ErrorBoundary Fix #435
Conversation
Security InsightsThe items listed below may not capture all security relevant changes. Before providing a security review, be sure to review the entire PR for security impact. (1) Security relevant changes were detectedInnerHtml in lib/src/component/error_boundary.dart line(s) ['100'] addedAction Items
Questions or Comments? Reach out on Slack: #support-infosec. |
* master: lower dockerfile to 2.6 instead of 2.7 wdesk sdk hasnt upped its pubspec yet... remove dart 2.4 references address cr feedback fix tests for redux 7.1.3 Update CHANGELOG.md over_react_3.1.6 remove unneeded `if` commit updated generated file from redux Remove dead code & help dart2js compile perf Add comment Update test/over_react/component_declaration/builder_integration_tests/component2/required_accessor_integration_test.dart Apply suggestions from code review Update dependency validator Add front_end dependency Format a little Address CR feedback Refactor required accessor integration suite Refactor required accessor test suite
expect(getByTestId(jacket.getInstance(), 'fallbackNode'), isNotNull); | ||
if (!isWrapper) { | ||
// wrapper ErrorBoundary doesn't use `props.fallbackUIRenderer` because `ResolvableErrorBoundary` | ||
// will display it on first error. Meaning wrapper ErrorBoundary will never be reached if it is set. |
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 child error boundary catching and displaying the fallback renderer is tested here:
https://github.com/Workiva/over_react/pull/435/files#diff-89d97c9289557c366adc6964193a6057R372-R388
class FaultyOnMountComponent extends UiComponent2<FaultyOnMountProps> { | ||
@override | ||
render() { | ||
throw Shade(); |
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 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.
+1
Nothin but nits
@@ -13,6 +13,8 @@ const String defaultErrorBoundaryLoggerName = 'over_react.ErrorBoundary'; | |||
/// within a custom component. | |||
/// | |||
/// > See: [ErrorBoundaryMixin] for a usage example. | |||
@Deprecated('Building custom error boundaries with this mixin will no longer be supported in version 4.0.0.' | |||
'Use ErrorBoundary and its prop API to customize error handling instead.') |
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
Co-Authored-By: Greg Littlefield <[email protected]>
swish! |
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.
+1
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.
QA +1
- Passing CI
- Pulled these changes into a consumer app in which I updated a component that is a child of an
ErrorBoundary
to throw from withinrender
.- Without these changes, throwing from within
render
resulted in the entire app being unmounted. - With these changes, only the problematic component was unmounted, and the rest of the application continued to work as expected.
- Without these changes, throwing from within
Nice work on this @kealjones-wk !!!
Security +1
|
@Workiva/release-management-p |
Motivation
Even with ErrorBoundaries in place, we were seeing issues with the app still entirely unmounting even with the logic for "unrecoverable" errors. It turns out in React if an ErrorBoundary catches an error, it will have its error lifecycle methods called, if on that render cycle the component throws during the render cycle React will move up the tree to a parent ErrorBoundary instead. And due to all the Previous ErrorBoundaries having the same logic none would ever handle the render cycle error.
Changes
ErrorBoundaryComponent
to handle render cycle unrecoverable errors (hopefully this wont happen often.)ErrorBoundary
logic intoRecoverableErrorBoundary
and nested it as the first child of the updatedErrorBoundary
.RecoverableErrorBoundary
was unable to recover, that the error is "Unrecoverable" and needs to be handled.Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: