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
Improve error handling for app extensions #17191
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.
LGTM, I didn't fully do extensive testing since it seemed like you did a lot with your gif's and the changes from Rijk above still needing to be decided/made.
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.
Looking good, nice addition!
* add util function to get vue component name * add global error handler * add v-error-boundary component * use error boundary to wrap insights panels * use error boundary to wrap form interfaces * use error boundary in render display and template * use error boundary in extension options * use error boundary for flows operation overview * extract default options-overview into a component * add tests
Description
Closes ENG-56
Currently when an app extension is faulty or contains bugs, the error thrown will brick the app, thus requiring a browser refresh.
This PR aims to handle said errors more gracefully for app extensions such as panels, flows, interface and displays using the
onErrorCaptured()
lifecycle hook. It is then used inside a<v-error-boundary>
component, similar to React's Error Boundaries and a Vue counterpart of error boundary.For Module and Layout extensions, currently the added global error handler does prevent the app from breaking entirely anymore, but I've opted to not implement "low-level" error handler for them because they may incur more changes, to be more specific:
Module: After this PR, module that has error will be a blank route, but we can go back to previous page since the global error handler prevents it from crashing.
The blocker for lower level module error handler would be each module is wrapped by the
RouterPass
here:directus/app/src/modules/index.ts
Lines 42 to 49 in 6793d9f
which is a functional component used in several other places:
directus/app/src/utils/router-passthrough.ts
Lines 1 to 8 in 6793d9f
so if we want to narrow down and capture module errors "earlier", we may need to have another router view wrapper specifically for modules.
Layout: After this PR, layout that has error will just be empty (but nav, sidebar etc are all intact) and will not crash the app anymore.
THe blocker for lower level layout error handler would be layouts are generally wrapped into LayoutWrapper in several places, so if we wish to capture layout specific errors, we may need to cover all layout wrapper usages in the app.
Panels
Flows
Interfaces
Displays
render-display
render-template
Type of Change
Requirements Checklist
If adding a new feature: