-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Skip filtering if model didn't change #9112
base: v6.x
Are you sure you want to change the base?
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-9112--material-ui-x.netlify.app/ Updated pagesNo updates. These are the results for the performance tests:
|
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'll just comment because I'm not familiar enough with that code yet. But I generally prefer to fix this sort of problem by avoiding touching the model until it needs updating, by keeping a local version of the model in the editing component that is only written to the model once it's ready to be written. Then again, I don't know the code so maybe this approach is easier, in which case this PR LGTM.
prevFilterModelWithOnlyValidItems.current, | ||
); | ||
|
||
if (skipIfNoValidItem && filterModelIsEqualToPrevious) { |
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's opt-in because the filtering state is also used to track which groups are expanded or not. If we always run the check, when rowExpansionChange
is fired it may not update the state. Maybe after #8671 we can revisit this part.
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, I think after #8671 is merged, we can make it true by default.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Hey @m4theushw @flaviendelangle we are running into issues where the Do ya'll have a general estimate as to when this fix will go out? Thanks for your work on this, really appreciate it |
@karanaditya993 I don't have any estimation of when this PR will be merged, but note that it doesn't solve the problem you mentioned. When opening the filter panel and |
@m4theushw interesting...is this intentional? It seems like an unnecessary call (especially if The idea here is that we'd want to only have the |
I'm also noticing that when you open the filter panel from any of the columns (via the action menu on the column), the I will keep any eye out on the next few MUI releases to see if this is part of the release. In the meantime, I might copy paste the code you have here on an experimental fork to see if it resolves the issue we're having Thanks again for your help and quick reply! |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Related to #8225
We're applying the filter whenever the model changes, which means that only opening the panel already triggers the filtering, even though the filter item has no valid
value
yet. With 100k rows this causes a perceptible freeze as can be seen in https://master--material-ui-x.netlify.app/x/react-data-grid/#commercial-version and reported in the issue above. This PR skips the filtering step if the new filter model, containing only items that have avalue
or don't need one, is different from the last time the filtering ran. As can be see below the performance improved a bit. I wished we could properly fix this issue by keeping a copy of the filter model used for the filter panel and only callingonFilterModelChange
when the value is changed.The comparison below was done against https://mui.com/x/react-data-grid/#commercial-version by measuring the time to change the column inside the filter panel.
Before:
After: