-
-
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] Make rowCount
part of the state
#12381
Conversation
Deploy preview: https://deploy-preview-12381--material-ui-x.netlify.app/ |
@@ -32,4 +33,5 @@ export interface GridApiPro | |||
export interface GridPrivateApiPro | |||
extends GridApiPro, | |||
GridPrivateOnlyApiCommon<GridApiPro, GridPrivateApiPro, DataGridProProcessedProps>, | |||
GridDetailPanelPrivateApi {} | |||
GridDetailPanelPrivateApi, | |||
GridInfiniteLoaderPrivateApi {} |
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.
I don't understand why these changes were not detected in #8672 😕
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.
I see no reason not to port this to v6 since there's no breaking change now, please share if any objections
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.
I'm fine with that. My PR was simpler but having both versions use the same code is better.
rowCount
part of grid staterowCount
part of the state
@@ -524,12 +524,13 @@ describe('<DataGrid /> - Pagination', () => { | |||
}); | |||
}); | |||
|
|||
it('should react to an update of rowCount', () => { | |||
it('should react to an update of rowCount when `paginationMode = server`', () => { |
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.
This is an updated behavior, now rowCount prop will only be synchronized when paginationMode
is server
since on client mode, internal computation makes more sense for rowCount
calculation as rows
are available. (I can't think of any legitimate use-cases affected from this change)
Any objections?
Extracted from #12317
Fixes #8450
Before: https://codesandbox.io/p/sandbox/brave-goldberg-3lve8e
After: https://codesandbox.io/p/sandbox/black-field-445pzy
Backport to v6 ([DataGrid] Make
rowCount
part of the state #12406)