-
-
Couldn't load subscription status.
- Fork 1.7k
[data grid] Performance: selectors #18234
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
Conversation
| export const gridPreferencePanelSelectorWithLabel = createSelector( | ||
| gridPreferencePanelStateSelector, | ||
| (panel, labelId: string) => { | ||
| (panel, labelId: string | undefined) => { |
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.
The typings from the base-ui selector functions are more precise, they can catch more issues.
|
Deploy preview: https://deploy-preview-18234--material-ui-x.netlify.app/ Bundle size reportTotal Size Change: @mui/x-data-grid-pro parsed: Show 2 more bundle changes@mui/x-data-grid-pro/DataGridPro parsed: |
| (apiRef: RefObject<GridApiCommunity>) => | ||
| apiRef.current.state.virtualization.renderContext.firstColumnIndex, | ||
| (apiRef: RefObject<GridApiCommunity>) => | ||
| apiRef.current.state.virtualization.renderContext.lastColumnIndex, |
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.
The create selector functions only accept state selectors, not apiRef selectors, but these aren't public so I think this is fine.
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 a consequence of removing weakMapMemoize and using unwrapIfNeeded, right?
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.
Yes, every selector passed into createSelector(Memoized) now needs to handle that the first param is apiRefOrState. Only these two inline selectors weren't doing it.
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 removed this in favor of the unwrapIfNeeded logic.
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.
The base-ui selectors support multiple arguments (very efficiently), but we can't because our useGridSelector(api, selector, args?, equals?) wrapper has the equals argument blocking more arguments. We should rework that API at v9, we do need multiple arguments at some places and we use inefficient param objects instead. We could add useGridSelectorV9, and an alternative useGridSelectorWithEquals(api, selector, equals, ...args) for the limited cases where we need equals.
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.
Added to #17846
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 didn't quite get where the performance-related changes are. Could you clarify this?
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.
Added to #17846
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.
Why don't we use it anymore?
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.
The old implementation calls reselect's |
Also, the previous implementation had two |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
f8a512a to
8d62906
Compare
8d62906 to
8e6196b
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
I found major changes in the way the grid selectors worked from V7 to V8. Specifically: These selectors fired in strange ways (multiple firing, resetting the page to 0) when not using the new datasource. I had to work around them to get this upgrade in. In V7 I could switch from the out of the box pagination, or my custom one, based on the state returned by those selectors with zero issue. In V8, even the out of the box one didnt work (with server side pagination, sorting and filtering). I just tried 8.5.2, and the pagination doesn't work at all with a purely server side grid , and still fails. |
|
Is it related to the changes in this PR specifically? Can you open a new issue with a reproducible example? |
|
It is not related to this change - I hoped that it was fixed by it. I will work on a case. |
Import the selectors implementation from base-ui.