Skip to content
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

[DataGrid] Add use client directive to the Grid packages #11803

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

MBilalShafi
Copy link
Member

@MBilalShafi MBilalShafi commented Jan 24, 2024

Closes #11699

For the simple use cases when no function (or something non-serializable) is used in the App Router code using Data Grid, this PR will help to not force the users to use use client directive on their side.

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! nextjs labels Jan 24, 2024
@mui-bot
Copy link

mui-bot commented Jan 24, 2024

Deploy preview: https://deploy-preview-11803--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 6e64f73

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
Copy link

github-actions bot commented Feb 7, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 28, 2024
@MBilalShafi MBilalShafi marked this pull request as ready for review February 28, 2024 07:14
@MBilalShafi MBilalShafi merged commit e6c6161 into mui:next Feb 28, 2024
17 checks passed
@MBilalShafi MBilalShafi deleted the use-client-directive branch February 28, 2024 09:21
@cherniavskii
Copy link
Member

Do we need to add "use client" to the exported subcomponents, like GridToolbar?

@MBilalShafi
Copy link
Member Author

MBilalShafi commented Feb 28, 2024

Do we need to add "use client" to the exported subcomponents, like GridToolbar?

Yes, we could, won't it apply to every other slot component too though? As a reference, I tried to use GridCell and GridColumnMenu slots (import and pass in slots) both of which in addition to all the React.createContext instances also required a dedicated use client directive.

I'd propose adding it to the entry point index.js instead, which will resolve it for all the components, utils, etc. exported from the Grid. We could always remove it (or move to specific files) whenever some server-side rendering need arises as mentioned in #9833 (comment)

Wdyt?

thomasmoon pushed a commit to thomasmoon/mui-x that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! nextjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Next.js App Router support
4 participants