-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Plugins: Add error boundary #38397
Plugins: Add error boundary #38397
Conversation
Size Change: +475 B (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
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 is very cool and it looks very simple implementation wise. Can we add an e2e test for it maybe?
Also should we implement in in the site editor too?
Sounds good to me.
I will add handlers to both Site and Widget editors. I just wanted to share the current implementation for feedback. Do you think we should add the "Copy error" action to the notice? I checked other error boundaries, and we have mixed UIs. For example, block boundary doesn't include actions, while general editor one does. |
@Mamaduka I think I'd prefer without it personally as in general the copied error is minified... and doesn't add much value. I didn't hear much feedback about that button in the general editor boundary so would love to be proven wrong :) |
I agree minified error message and trace isn't practical. At least in my experience when they are included in issues. We can always include that later if there's a need for it. Thanks again for the feedback, @youknowriad. |
bcf0ea0
to
c18facd
Compare
I think the code is ready for final review. After the checks are complete, I will push documentation updates to ensure e2e tests aren't flaky. They work locally, but you never know. |
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.
Cool work here George!
I've left some minor comments but this looks good! Thanks!
Some discussion here on the general editor boundary, btw - #34482 I'm not sure I agree that the error messages aren't useful. They can sometimes provide information on where the error is even when minified. Or at least let the developer know which kind of error is happening. |
Thanks for mentioning the general issue, @talldan. I just subscribed and am happy to help with development as well.
I don't have a strong opinion on this, and we can always add the "Copy" action later. |
Let's merge this. Happy to follow up with the "Copy" action button if/when we see a need for it. |
@bph, I'm not sure if this needs Dev Note. Yes, it improves developer experience but also requires zero actions from them :) Anyway, happy to write a few words if we want to mention the improvement. |
@Mamaduka I wasn't quite sure, but from what I learned listening to developer trying to work with blocks sometimes the error messages are not helpful, or don't point to the right places to start debugging. So anytime you improve things, it's a small win to be celebrated. It might not warrant an individual post but we will have a "Miscellaneous' DevNote where we gather a few smaller changes. :-) |
I think it's worth mentioning in Misc. P.S. Error boundary won't point folks in the right direction. It just prevents one error from crashing the whole editor. |
Description
PR adds an error boundary around the plugin renderer component.
The editors can handle displaying error messages using the new
onError
prop ofPluginArea
. It's a callback that will receive the plugin's name and an error.Resolves #9630.
Todos
onError
prop.Testing Instructions
Screenshots
Types of changes
Enhancement
Checklist:
*.native.js
files for terms that need renaming or removal).