-
-
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] Replace eval with new Function #11557
Conversation
Deploy preview: https://deploy-preview-11557--material-ui-x.netlify.app/ |
packages/grid/x-data-grid/src/hooks/features/filter/gridFilterUtils.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid/src/hooks/features/filter/gridFilterUtils.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Rom Grk <romgrk@users.noreply.github.com> Signed-off-by: Olivier Tassinari <olivier.tassinari@gmail.com>
const filterItem: GridFilterItemApplierNotAggregated = (row, shouldApplyItem) => { | ||
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem); | ||
}; | ||
filterItemsApplierId += 1; | ||
|
||
return filterItem; | ||
return (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem); |
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.
Sometimes I like assigning functions to a variable because it gives a better debugging experience, the stack entry would read filterItem - .../gridFilterUtils.js:294
instead of (anonymous) - .../gridFilterUtils.js:291
. It's useful when stepping through code but also when collecting performance profiles. With this change I'm also not sure what the name of filterItemCore
becomes.
It's fine to leave as it is, but just fyi.
18bf330
to
0a03dd4
Compare
0a03dd4
to
e6095c3
Compare
@romgrk thanks for the reviews. |
I was curious if we could improve this logic:
getRowId
was removed in [DataGrid] Remove legacy filtering API #10897, no need to provide it as an argument anymore.atob('ZXZhbA==')
, it feels like obfuscation and fix @mui/x-data-grid-premium "ReferenceError: atob is not defined" #11046eval and new Function are by default sloopy https://2ality.com/2014/01/eval.html, made it strict.