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
[UI] Add Validation and Error Boundaries #8833
Conversation
Signed-off-by: aabidsofi19 <mailtoaabid01@gmail.com>
Signed-off-by: aabidsofi19 <mailtoaabid01@gmail.com>
Signed-off-by: aabidsofi19 <mailtoaabid01@gmail.com>
…into notification-center
Signed-off-by: aabidsofi19 <mailtoaabid01@gmail.com>
|
||
export const withErrorBoundary = (Component) => { | ||
const WrappedWithErrorBoundary = (props) => ( | ||
<ErrorBoundary FallbackComponent> |
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.
<ErrorBoundary FallbackComponent> | |
<ErrorBoundary Fallback> |
Or I am missing something?
|
||
return ( | ||
<div role="alert"> | ||
<p>Something went wrong:</p> |
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.
<p>Something went wrong:</p> | |
<h3>Please pardon the mesh</h3> |
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.
We can add error boundary to the top level app , also the component lvl boundary could be made more specific to include the comp name or filename which caused the error. As stacktrace might be difficult to trace through sometimes.
in case of multiple error boundary closest one will be executed
|
||
//TODO: This should be generated from OPENAPI schema | ||
const EVENT_SCHEMA = { | ||
type : "object", |
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 schema is already present but the contract b/w fronted and backend is missing.
also, this schema is inaccurate as it lacks category and action
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.
we were not using that in frontend anywhere yet , thats why forgot . will add those
|
||
|
||
|
||
const EVENT_METADATA_SCHEMA = { |
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.
This isn’t always the case, in long operations i.e. an operation which invoked multiple other operation the metadata contains a summary which is not an error specifically.
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.
Very good point regarding errors being one of a number of different types of events.
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.
Thanks Uzair , i have not considered that . do you have an example response for this kind of situation
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.
We can add error boundary to the top level app , also the component lvl boundary could be made more specific to include the comp name or filename which caused the error. As stacktrace might be difficult to trace through sometimes.
in case of multiple error boundary closest one will be executed
+1
I too think that adding error boundary at root level would be more beneficial. As by doing that we would resolve not only the notifications center issues but unwanted UI crashes in general. Would help us to be future-proof
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.
Follow up on review suggestions separately.
error boundary at root level is good to catch all the errors but that also means we wont have a usable ui on error . the more granular we go the better ux and easy debugging . But I Agree to your point that there should be a balance and every component might not need it . |
Notes for Reviewers
This PR fixes the crash of ui on invalid/corrupt events and adds error boundaries for gracefull error handling
Notes :
Signed commits