-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(live-codeblock): add error boundary to live code preview #8015
Conversation
Hi @rashidmya! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Note, we already have an error boundary component in core: https://docusaurus.io/docs/docusaurus-core#errorboundary Please just reuse this one |
You should provide a custom |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Its working correctly now. any notes? |
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 does not render very nicely
Please make sure the error is displayed nicely, maybe keep the "results" header tab, and ensure there's still the padding/background?
We want the design to be consistent with other playground errors such as:
Maybe you could reuse the LiveError
component? 🤷♂️
Note you introduce a new translation label but do not provide translations for it (and thus CI fails). You could reuse the key "theme.ErrorPageContent.tryAgain" to fix this. I can't merge if the CI fails
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 looks better yes!
packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx
Outdated
Show resolved
Hide resolved
@slorber why does CI fail when I added styles for the component |
The CI says it: you just added an extra LGTM 👍 just did minor fixes Note I tried to do some kind of "auto try again on code change" behavior but it's complicated because it seems Also we still have weird annoying cases where both the live error and the error boundary crash are displayed at the same time. Tried to improve but react-live does not make it very easy unfortunately When code change from "crash" to "react-live-error" state, both are displayed. Unless we find a way to autoretry the error boundary I think it's better to display the live error in addition (even if it's weird) rather that staying on the rough error boundary crash message: Those are edge cases, probably not worth investing a lot of time on these atm |
Pre-flight checklist
Motivation
Fixes page crashing when typing
undefined
or{}
in live editorTest Plan
Test links
Deploy preview: https://deploy-preview-8015--docusaurus-2.netlify.app/
Related issues/PRs
fix #8009