-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add use client
directive to all components in a new build step
#9833
Comments
I'm having the same problem 😭 |
Bump, was just about to raise this 👍 |
The components in the lab are getting covered mui/material-ui#40358. Does someone has a practical use case for this issue? I guess with rich components like MUI X has its rare for the component that renders it to not already have "use client"? So maybe the value is on the ease of getting started? |
Clarifying that MUI Core uses https://github.com/mui/material-ui/blob/master/packages/rsc-builder/buildRsc.ts to automate it. |
Which is a script that I think we can make much better:
|
It seems like for the Data Grid packages, we can add |
The closer to the use of client APIs, the better though. If people want to use some of the API on the server, a use client in all the index would prevent them to. Maybe one in https://github.com/mui/mui-x/blob/next/packages/grid/x-data-grid/src/DataGrid/DataGrid.tsx would cover 80% of the problem. |
@oliviertassinari Overall, I agree. |
@cherniavskii I wonder about the work we are doing to better support server-side integration though. We experienced cases like this in the core: mui/material-ui#42750. |
Interesting point, though as of now I can not foresee any server-rendered component for the server-side integration as the initial goal is data fetching on the client, I'm not sure if that'll be the case later on too. Let's start with adding "use client" in |
Oh, now I might understand why nobody asked for using a data grid from a server component, but asked for the charts. It might be because of https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#passing-props-from-server-to-client-components-serialization, the columns definitions of the data grid, and as many other props aren't serializable, so people need to add "use client" where they render them So the benefits of adding "use client" on MUI X Data Grid is very limited. For example, I don't understand why they do this https://www.telerik.com/kendo-react-ui/components/server-components/, for charts yes mui/material-ui#12180, but for a data grid I don't see the point. |
Hey! Are there any plans of adding |
Summary 💡
Same as mui/material-ui#37503
Examples 🌈
No response
Motivation 🔦
To feel the pain:
Saving step 4. would be great.
Context
This is part of improving the integration with Next.js App Router. I have also noticed bugs with it, but these are beyond our control:
next dev
vercel/next.js#48284transform-origin
vercel/next.js#53342The text was updated successfully, but these errors were encountered: