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] Allow passing readonly arrays to pageSizeOptions prop #11609

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

pcorpet
Copy link
Contributor

@pcorpet pcorpet commented Jan 7, 2024

Contributes to #10685

@mui-bot
Copy link

mui-bot commented Jan 7, 2024

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

Generated by 🚫 dangerJS against b5a413a

@pcorpet
Copy link
Contributor Author

pcorpet commented Jan 8, 2024

Will require mui/material-ui#40481 first

@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Jan 8, 2024
@flaviendelangle
Copy link
Member

Will require mui/material-ui#40481 first

Just in case,
I don't think we want to bump @mui/material minimum version just for this improvement.
I'm not sure if using an older version of @mui/material and a version of @mui/x-data-grid with your improvement will cause a TS error.
If it does, we should add a type casting IMHO.

@pcorpet pcorpet force-pushed the readonly-page-size-options branch 2 times, most recently from ef4927f to 4f3d499 Compare January 8, 2024 21:25
@pcorpet
Copy link
Contributor Author

pcorpet commented Jan 8, 2024

Just in case, I don't think we want to bump @mui/material minimum version just for this improvement. I'm not sure if using an older version of @mui/material and a version of @mui/x-data-grid with your improvement will cause a TS error. If it does, we should add a type casting IMHO.

Thanks for the heads' up. I've added a cast and left some documentation around it.

@@ -304,7 +304,7 @@ export interface DataGridPropsWithDefaultValues {
* Select the pageSize dynamically using the component UI.
* @default [25, 50, 100]
*/
pageSizeOptions: Array<number | { value: number; label: string }>;
pageSizeOptions: readonly (number | { value: number; label: string })[];
Copy link
Member

@oliviertassinari oliviertassinari Jan 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More consistent in the codebase? We are using ReadonlyArray over readonly in mui/material-ui#40481 and mui/material-ui#40754

Suggested change
pageSizeOptions: readonly (number | { value: number; label: string })[];
pageSizeOptions: ReadonlyArray<number | { value: number; label: string }>;

Copy link

github-actions bot commented Feb 5, 2024

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

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 5, 2024
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Feb 5, 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.

@oliviertassinari oliviertassinari changed the title [DataGrid] Allow passing readonly arrays to pageSizeOptions prop [data grid] Allow passing readonly arrays to pageSizeOptions prop Feb 7, 2024
@cherniavskii cherniavskii changed the title [data grid] Allow passing readonly arrays to pageSizeOptions prop [DataGrid] Allow passing readonly arrays to pageSizeOptions prop Feb 8, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 8, 2024
@cherniavskii cherniavskii added typescript PR: out-of-date The pull request has merge conflicts and can't be merged needs cherry-pick The PR should be cherry-picked to master after merge and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Feb 8, 2024
Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@cherniavskii cherniavskii enabled auto-merge (squash) February 8, 2024 11:02
@cherniavskii cherniavskii merged commit 641b6d2 into mui:next Feb 8, 2024
19 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 8, 2024
…11609)

Co-authored-by: Andrew Cherniavskyi <andrew@mui.com>
@pcorpet pcorpet deleted the readonly-page-size-options branch July 18, 2024 21:54
thomasmoon pushed a commit to thomasmoon/mui-x that referenced this pull request Sep 9, 2024
…ui#11609)

Co-authored-by: Andrew Cherniavskyi <andrew@mui.com>
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! needs cherry-pick The PR should be cherry-picked to master after merge typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants