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
CONSOLE-3093: Add Error Boundaries around extension components #11607
CONSOLE-3093: Add Error Boundaries around extension components #11607
Conversation
/assign @christianvogt @vojtechszocs @jhadvig |
f266d42
to
868b203
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.
IMO, there should be some distinction between inline or page-level error boundary fallbacks. See comments. I also think it might make sense to keep the ErrorBoundaryFallback component alongside ErrorBoundary in console-shared since it's consumed by other packages.
frontend/packages/console-shared/src/components/dashboard/activity-card/ActivityBody.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-app/src/components/user-preferences/UserPreferenceCustomField.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-app/src/components/user-preferences/UserPreferenceCustomField.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-shared/src/components/dashboard/activity-card/ActivityBody.tsx
Outdated
Show resolved
Hide resolved
868b203
to
e1e847a
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.
@TheRealJon I've reworked the whole PR. Improved the error handling and rendering code by bringing it all into shared with new content for inline error boundaries.
I've broken it all down with readable commit names, so hopefully it's easier to consume. But this is effectively a new PR with the changes within'.
/retest |
/retest It's a connection error -- I'm hoping it's just a hiccup and not an infra issue |
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
/retest |
2 similar comments
/retest |
/retest |
e1e847a
to
e4bdb08
Compare
There was a merge that conflicted with the ErrorBoundary code -- needed to do a change fix an import path. Also rebased to try and cut down on anymore of those. |
/label tide/merge-method-squash |
/assign @yapei /assign @RickJWagner /assign @opayne1 /cc @megan-hall |
/retest |
Hi @andrewballantyne , |
/label docs-approved |
/label px-approved On behalf of Rick. |
Thanks for tagging us Andrew! I think we can keep what you have in your PR for now (and make a small adjustment to the padding so the one on the details card is clearly not associated with the content below). I do think it is worth revisiting for 4.12 - perhaps we can consider creating an alert and think through some of the UX details a bit more. I can create a PD story for that so we don't lose track. |
@megan-hall done. See new updated description screenshot for the whole page -- here is the closeup of the Details Card: |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, TheRealJon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@andrewballantyne: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
changes are verified after applying diff
|
Adds error boundaries around extension mounting so that if a runtime render error is thrown, the component from a plugin cannot crash our application.
Some test extensions: https://gist.github.com/andrewballantyne/fbbe6404d9bfdc09b172b55a04f4b2cd
What This Does For Users
There are many ways code can crash and sometimes these crashes can be more than a call not made or an item not updated. Sometimes these crashes take the whole app with it -- giving us the "white screen" situation.
React gives us something called Error Boundaries. These are special types of components that you can place anywhere in your React tree of components to only crash smaller parts of your app when things go awry. Even better, we can also put in fallback components to help more gracefully handle what happens when these crashes happen.
Now, add Dynamic Plugins into the mix, and all of a sudden we do not control all of our code running in OpenShift Console. Thus, what happens if a Dynamic Plugin brings in a component that crashes. We have a top-level Error Boundary, but can we do better? In comes this PR.
We wrap Error Boundaries around the usage of components brought in by plugins to help crash in smaller parts. Two types of error handling are done here.
See below for instances and what they'll look like in the UI. It is important to note this shouldn't ever happen in a live running production environment, but as we all know -- bugs happen.
Error states and what they look like in the UI
Inline error states during Dashboard Cards, activity, and inventory items:
What the view details shows us:
Other examples of inline:
Add Storage is interesting -- I went with full screen error because most of the content we render is taking very little of the page:
And naturally our normal error boundary (when say a route crashes):