-
Notifications
You must be signed in to change notification settings - Fork 119
Create componentWithErrorBoundary HOC for more graceful failure #11394
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
base: main
Are you sure you want to change the base?
Conversation
|
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.
Do we need to wrap all these components with error boundary? imo maybe it makes sense to target "Page" and "Modal", and then maybe areas that we think are prone to errors?
My take here is that we should be as detailed & low level with these error boundaries as possible. And leave If, for example, a like button is erroring...who cares, we should take it out of the DOM and let the rest of the app be as is. as long as the listening experience isn't affected and the removal of an item doesn't break the whole flow, things should either render as null or show their own individual error state and the rest of the app should be left alone. a small thing breaking in a modal, such as a like button, shouldn't bork the whole modal, so we shouldn't only leave the error boundaries so high up.
I think yes, that was the methodology I attempted to go with here, but lmk if you think any of these files don't follow that. the general thinking here is that these follow one of:
We should also discuss error states with design. Perhaps some of these should have their own error UI instead of just returning null. But for now, I think null is ok |
Description
Added a new Higher Order Component (HOC)
componentWithErrorBoundary
that wraps React components with error boundary functionality. This HOC:Why
Currently, unhandled errors in any component can cause the entire app to break.
By implementing error boundaries, we can:
When to Use
Apply this HOC to components that:
Examples:
Do NOT use for:
Implementation Note
For this initial PR, all error boundary instances will render
null
as their fallback UI.How Has This Been Tested?
The
ProfileTopTags
component is currently causing a full screen error. Added HOC and checked if it stopped showing the fullscreen error and that it logged the error to console