-
-
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
undefined
crashes live codeblock
#8009
Comments
👍 Couldn't repro on react-live playground: https://react-live.netlify.app/ So this must be a Docusaurus bug 🤷♂️ |
can I try doing this? |
@rashidmya Can I take this? I have PR ready for this. |
@rashidmya sure, no need to ask. In the worst case we just need to add an error boundary. We already have such a component in core. |
@thelovekesh i'd like to take a shot at this if thats okay |
@rashidmya Ya sure. Since I have looked into this so here are some findings that can help you:
|
I believe we had compatibility issues in the past and ended up pinning the react-live version. I think for now we can simply add an error boundary to display the error gracefully. |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
The live codeblock crashes the entire page on inputs that cause React to try to render
undefined
.I can work around this by changing
transformCode
to have an|| null
in case the code returnsundefined
.Reproducible demo
No response
Steps to reproduce
undefined
Edit: Also happens if you replace the live codeblock text with
JSON
Expected behavior
The entire page does not crash and the code block renders an error instead.
Actual behavior
The entire page (not just the code block) crashes with the error message
Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=n for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: