Skip to content

undefined crashes live codeblock #8009

Closed
@isaacbrodsky

Description

@isaacbrodsky

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

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 returns undefined.

Reproducible demo

No response

Steps to reproduce

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

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiongood first issueIf you are just getting started with Docusaurus, this issue should be a good place to begin.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions