codesandbox / codesandbox/codesandbox-client

Codesandbox preview error when using React 19

Open
#8,673 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🐛 bug report

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

After React 19 was released, we noticed that some of our demos (e.g. https://mui.com/x/react-data-grid/#pro-plan) show an error when opened in Codesandbox: https://codesandbox.io/p/sandbox/floral-http-hll4y8

When the preview is opened in a new tab, the error isn't shown: https://hll4y8.csb.app/

How has this issue affected you? What are you trying to accomplish?

We get bug reports about this in our repo: https://github.com/mui/mui-x/issues/15765

To Reproduce
Link to sandbox:

The error is only reproducible with React 19.

❌ With React 19: https://codesandbox.io/p/sandbox/elastic-forest-nhckjq
✅ With React 18: https://codesandbox.io/p/sandbox/rough-browser-xvhfll

It looks like the Codesandbox client patches the console.error function.
If I use console.log instead of console.error, the error is gone.
When I patched console.error myself, the error was gone too: https://codesandbox.io/p/sandbox/white-shadow-4hpjxn

Your Environment
Software Name/Version
Сodesandbox 0.0.375
Browser Chromium: 131.0.6778.85 (Official Build) (arm64)
Operating System MacOS 15.1.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproductions and compare the React 18 and React 19 cases, focusing on the embedded preview and the console.error behavior described in the report. The issue is resolved when the React 19 demos no longer show an error in the embedded CodeSandbox preview while preserving the working new-tab preview.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
devtools, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.