-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[DataGrid] Warn when pageSize is not present in rowsPerPageOptions #2014
[DataGrid] Warn when pageSize is not present in rowsPerPageOptions #2014
Conversation
The snapshots changes are expected, we don't pass Before this PR, the default one did not include the |
@oliviertassinari , I updated the behavior as discussed yesterday 👍 |
Their is an error on a test because the effect runs with the default |
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.
👍 for the current direction
bf01dd7
to
1940d1f
Compare
1940d1f
to
8ebd389
Compare
@flaviendelangle I have rebased and updated the tests to pass. A codesandbox with the new DX: https://codesandbox.io/s/material-demo-forked-pjlyc?file=/demo.tsx. However, having to include 100 in the list, that's not flying 😁. The simplest might be to add a hack for 100 and to leave a TODO. Updating the options in an effect? It's borderline. I think that it would only work under two conditions: 1. We initiate the state with the right initial options (KO currently) 2. We make the child of the state provider a memo, to always stop the React rendering so that children only render once per option updates (KO currently). Otherwise, we can use React, create a dedicated context for the options (top-level props). |
In #1720 a new |
I'll finish this one once the controlled pagination is merged |
f09aa4d
to
76d0718
Compare
@oliviertassinari if I set a global variable to only warn once, it's not reset between two tests so 2 of the 3 tests don't have the warning. |
ExportIcon: GridSaveAltIcon, | ||
}; | ||
|
||
export const DEFAULT_GRID_SLOTS_COMPONENTS: GridApiRefComponentsProperty = { |
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.
Same reason as https://github.com/mui-org/material-ui-x/pull/2213/files#r676538144
It's to avoid circle import
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.
Looks good
packages/grid/_modules_/grid/hooks/features/useGridComponents.tsx
Outdated
Show resolved
Hide resolved
@oliviertassinari what was the goal of adding the |
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@flaviendelangle To dodge the initial value issue. You fixed this using the root props context. |
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.
It looks clean
One chunk of #1907