-
-
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] Use new selectors #15200
[DataGrid] Use new selectors #15200
Conversation
Deploy preview: https://deploy-preview-15200--material-ui-x.netlify.app/ Updated pages: |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
0f54568
to
44438c0
Compare
( | ||
apiRef: React.MutableRefObject<{ state: State; instanceId: GridCoreApi['instanceId'] }>, | ||
args?: Args, | ||
): Result; | ||
(state: State, instanceId: GridCoreApi['instanceId']): Result; | ||
(state: State, args?: Args, instanceId?: GridCoreApi['instanceId']): Result; |
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.
Instance ID parameter being required feels unnecessary.
- We allow slicing data without passing it, it could be fine if the user is aware of the performance issues a respective selector may cause.
- It doesn't apply to non-memoized selectors.
- Even for the memoized selectors, we warn the users to beware of the possible performance issues and act accordingly.
With #11440 it would even be more relevant as the only officially supported way would be the selector(apiRef)
. Comments are welcome.
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.
As long as we do #11440, we can get rid of those for v8.
cellParams1.api.state, | ||
cellParams1.api.instanceId, | ||
); | ||
const model = gridRowGroupingSanitizedModelSelector({ current: cellParams1.api }); |
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.
A step towards #11440
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're passing api
in a few places, we should probably consider replacing those with 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.
I think it couples more with #11440, let's consider it when working on that.
Closes #15478
Todos
Follow-ups:
Changelog
Breaking changes
The selectors signature has been updated due to the support of arguments in the selectors. Pass
undefined
asarguments
if the selector doesn't use any arguments.The
useGridSelector
signature has been updated due to the introduction of arguments parameter in the selectors. Passundefined
asarguments
if the selector doesn't use any arguments.