-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
[joy-ui][GlobalStyles] Ensure compatibility with RSC #38955
Conversation
Netlify deploy previewhttps://deploy-preview-38955--material-ui.netlify.app/ @material-ui/core: parsed: +Infinity% , gzip: +Infinity% Bundle size reportDetails of bundle changes (Toolpad) |
Off-topic This makes me wonder as we don't do it in this PR, @mj12albert why add this in #37656? material-ui/packages/mui-material/src/GlobalStyles/index.js Lines 1 to 2 in 6e45f83
How about we remove all of those? |
@oliviertassinari Without However I tried to make a sandbox based off your PR to show this and can't reproduce that error anymore, so maybe it's no longer needed now |
@mj12albert A reproduction of the issue raised in #37656 (comment): https://stackblitz.com/edit/github-9lau57-jwzhw4?file=package.json,src%2Fapp%2Fpage.tsx. It looks like the problem was that we were missing "use client" in files that were client components, for example in In #38967, the issue seems to be gone. |
@@ -1,11 +1 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mj12albert the index file also needs 'use client';
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, based on https://github.com/mui/material-ui/pull/38967/files#diff-dafb0dc18749ba2c9f0efdec79126704f72fc6a105b2247580eb3d268c067d84, it is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great first PR! looking forward to the next one. Thanks a lot!
Closes #38494
What I Did
In this pull request, I made the following changes:
GlobalStyles.tsx
, in thepackages/mui-joy/src/GlobalStyles
folder.packages/mui-joy/src/GlobalStyles/index.tsx
file to export theGlobalStyles
.yarn rsc:build
to insert theuse client
directive into theGlobalStyles.tsx
file.I followed the guidance provided by @siriwatknp in the following comment: #38494 (comment).