-
Notifications
You must be signed in to change notification settings - Fork 27k
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
_owner field of React component set to different value after enabling turbopack #71878
Comments
Can you apply the binary search approach to debugging. Take your root page / layout and make them just show basic “hello” and “world”. The issue should go away. then reintroduce the code bit by bit. So introduce your root layout but keep the page as just “world”. This will allow you to determine if the issue exists in the layout or in the page / the nested pages. Slowly uncomment parts of your code bit by bit until the issue comes back. Then you can identify what erroneous code is causing the issue. Turbopack works fine for me. But when I first tried to set it up I had to do the above approach to figure out what was causing me issues. I hope this advice helps. It can be applied to many problems. |
You’re totally right and I should have explained this better. I tried to follow this approach when making the repro, and the part that is causing the error is adding When I’m at my pc again I’ll edit my post and look further. But I should have at least mentioned this before in my repro… I’ll also try to repro this issue in plain code without using MUI, but I haven’t be able to so far. |
Rewrote the repro from scratch, without any dependencies. Let me know if I can do more to clarify! :) |
Issue still occurs on just 15.0.3-canary.1. |
After upgrading from 15.0.1 to 15.0.2 this issue also occurs without turbopack when running After investigating 15.0.2-canary.9 still works fine (on non turbo dev) and on 15.0.2-canary.10 the issue starts happening. Most likely it was this PR (because it aligned turbopack behaviour with webpack): #71968 I'm now wondering if this should be considered a bug or not. You can make the point that the deepClone behaviour is incorrect, but this code still works fine on a regular old client-only app with (for example) Vite. Since I think it might be valid that it's a MUI issue, I've created this issue over there: mui/material-ui#44278 A possible reason why this might be a Next (or even a React?) issue, is that I can't see why |
Closing this, because the issue has been resolved for MUI, and because the scope changed since creating this issue. The customer changed from "Why is this different between Webpack and Turbopack?" to "Why is this field suddenly set?". |
Link to the code that reproduces this issue
https://github.com/nphmuller/next15-turbo-maxstack-repro
To Reproduce
npm install && npm run dev
RangeError: Maximum call stack size exceeded
.If you remove --turbo in package.json there is no error.
Main part of repro: https://github.com/nphmuller/next15-turbo-maxstack-repro/blob/master/app/wrapper.tsx
Manual repro:
Based on create-next-app.
layout.tsx:
Current vs. Expected behavior
Expected: No error
Current:
Error in console. Full stack trace:
Provide environment information
❯ npx next info Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 20.13.0 npm: 10.8.3 Yarn: N/A pnpm: 9.6.0 Relevant Packages: next: 15.0.1 // Latest available version is detected (15.0.1). eslint-config-next: 15.0.1 react: 19.0.0-rc-69d4b800-20241021 react-dom: 19.0.0-rc-69d4b800-20241021 typescript: 5.6.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I also tested against the latest preview release (
15.0.2-canary.7
) and the issue still repros.It seems that the value of the _owner key of the to be cloned component has a different value between webpack (null) and turbopack (see below). The value in turbopack seems to cause an infinite loop in the deepClone code.
The value of _owner when ran via turbopack is:
While the repro looks pretty exotic, it's mainly there to have an example without any external dependencies.
Here's a more practical example of the code that originally caused the error: https://github.com/nphmuller/next15-turbo-maxstack-repro/blob/0d1bfdfbc86441fc0603c151e36ecfac4892ace9/app/wrapper.tsx
The text was updated successfully, but these errors were encountered: