-
-
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] Fix cell value type in quick filtering v7 #10884
[DataGrid] Fix cell value type in quick filtering v7 #10884
Conversation
Deploy preview: https://deploy-preview-10884--material-ui-x.netlify.app/ |
ecdef46
to
456018f
Compare
@@ -220,7 +221,7 @@ const getFilterCallbackFromItem = ( | |||
if (ignoreDiacritics) { | |||
value = removeDiacritics(value); | |||
} | |||
return applyFilterOnRow(value, row, column, apiRef); | |||
return applyFilterOnRow(value, row, column, getPublicApiRef(apiRef)); |
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.
We were passing private apiRef here
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.
Oops, nice catch 👍
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.
Can we create the API ref outside this function? I think this one is inside the filter loop, so we're doing O(n)
allocations if we call getPublicApiRef
here.
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 comment applies below, line 420.
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.
Thanks for catching it, updated it!
let columnValue = apiRef.current.getRowFormattedValue(row, column); | ||
if (apiRef.current.ignoreDiacritics) { | ||
columnValue = removeDiacritics(columnValue); | ||
} |
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 disadvantage compared to v6 filtering, where it was possible to overwrite the cellParams.formattedValue
.
Reverts c14f23c from #10569
I thought this was an optimization, but it turned out to cause issues with non-string column types.
E.g. for the
date
column type,value
is supposed to be of typeDate
, while it currently isstring
(because value formatter returns string).I have discovered this issue while working on #10581