-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[material-ui] Accessing element.ref was removed in React 19 #42604
Comments
Updated issue so it covers all cases and not only the Tooltip one. |
The Select component also appears the warning. My environment:
|
@luc-nham Right, we solved some of the instances of the issue but we didn't solve the issue. There are still hits for this: https://github.com/search?q=repo%3Amui%2Fmaterial-ui%20children.ref&type=code. Actually, we have 3 times the same components, so 3 times the same fix to apply?
At first sight, it doesn't seem to make sense, what's the direction? |
I see warnings about this when using |
@markedwards can you share a reproduction? I'm unable to reproduce using the Popover e.g. https://codesandbox.io/embed/ntwvd6 |
I'm get the same warning. |
@Joshbwr can you send a reproduction? I'm unable to reproduce, see https://codesandbox.io/p/sandbox/popover-mui-material-6-1-5-react-18-3-1-zhcs7v |
@aarongarciah I'm using nextjs v14.2.14 |
Here is a repro case, using Next.js and Joy: https://codesandbox.io/p/devbox/tender-albattani-7pdqjs It's important to use Next.js in order to repro this issue, it uses React's canary release internally, which is on version 19. |
same issue, just updated to next.js 15 and I get the error for Select and PopOver |
Same problem here with nextjs 15.0.2 hook.js:608 Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release. Error Component Stack
at Portal (Portal.js:26:5)
at Modal (Modal.js:81:31)
at MuiDrawer-root (emotion-element-7a1343fa.browser.development.esm.js:48:26)
at Drawer (Drawer.js:134:31)
at Customization (index.jsx:34:28)
at HeaderContent (index.jsx:30:41)
at div (<anonymous>)
at MuiToolbar-root (emotion-element-7a1343fa.browser.development.esm.js:48:26)
at Toolbar (Toolbar.js:55:31)
at header (<anonymous>)
at MuiPaper-root (emotion-element-7a1343fa.browser.development.esm.js:48:26)
at Paper (Paper.js:62:31)
at MuiAppBar-root (emotion-element-7a1343fa.browser.development.esm.js:48:26)
at AppBar (AppBar.js:112:31)
at Styled(Component) |
This comment was marked as outdated.
This comment was marked as outdated.
Same Error at my side too, migrated to next 15 |
Same error (NEXT 15 , REACT 18)
|
Same error |
Hey everyone. Please provide the Material UI version with which you're experiencing each issue and a minimal reproduction. This can be a link to a repository or a live example. Otherwise we won't be able to debug it. @JCB-K Regarding Joy UI, there's no plan to support React 19 at the moment, sadly. We're currently focusing on the Material UI package. @Merzouk-Ilyes, the log you posted shows a different error: |
I upgraded I don't have a repro, but the error manifests with 15.0.3 with 5.15.11. Edit: Changed the version of |
@DiegoAndai here's the correct error log , i'm using next V15, MUI V5.16.7, React
|
@misstickles @Merzouk-Ilyes, thank you for your replies. Currently, Material UI v5 doesn't support React 19's RC; only v6 does. We will backport the changes to v5. It's one of the tasks listed in #42381. We plan to begin backporting soon. So these errors are "expected" now, but we're working on fixing it. If you need React 19 right now and can't wait, I would recommend updating to Material UI v6, the update process should be straightforward. You can follow the progress of backporting on #44413. |
These errors are happening on MUI v6. See above. |
Hey, @markedwards. May I ask you to provide a live example? We weren't able to reproduce with v6 (comment). |
I have no yet been able to reproduce in a CodeSandbox, but it's definitely affecting multiple people as you see above. I'm not sure yet what's different. I'm on Next 14.2.17 for what its worth. |
Seeing this in Next 15 + MUI 6. Actually updated to 6 to fix and nada. Possibly related to this. |
Hey @DiegoAndai, Seeing this in Next 15.0.3 + MUI 5.16.6 + React 18.3.1.
|
@jessejamesrich may I ask you to share a reproduction? 😊 @Heet-Bhalodiya, this is expected as React 19 fixes are not yet implemented in v5, only v6. We're backporting the React 19 changes to v5 and will release a compatible version soon, but it has yet to be released. You can follow the progress here: #44413. You can also try upgrading to v6 😊 |
@markedwards sorry for the delay. Could you provide a minimal reproduction? This would help a lot, otherwise, we can't investigate it. A live example would be perfect. This StackBlitz sandbox template may be a good starting point. Thank you! |
I also just upgraded a project from Next 14 to 15, and I also got this error, but after also upgrading my Versions of stuff: |
If you're encountering this issue, you might have to update to the latest release of v5 or v6.
If you already updated and are still encountering it, please open a separate issue with a minimal reproduction. Thanks! |
I'm fixing one of them in: vercel/next.js#74334. Going to https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-pages-router and opening the /about page is enough to reproduce the problem. We should really get rid of |
Another one: styled-components/styled-components#5510. We did a workaround for this in #41388, but we might as well fix the root. |
In React 19, ref is now a prop and should be accessed through
props.ref
. We have some instances of this we should fix: https://github.com/search?q=repo:mui/material-ui%20children.ref&type=codeExample with Tooltip
https://codesandbox.io/p/sandbox/silly-sea-m9cjyn?file=%2Fsrc%2FDemo.tsx
Context
material-ui/packages/mui-material/src/Tooltip/Tooltip.js
Line 560 in 5149a65
Your environment
react v19.0.0-rc.0
@mui/material v5.15.19
The text was updated successfully, but these errors were encountered: