[datagrid] Refactor: make all selectors accept the same argument #11440
Labels
breaking change
component: data grid
This is the name of the generic UI component, not the React module!
v8.x
Currently, grid selectors either accept the
apiRef
, or theapiRef.current.state
, so calling them directly can look like this:It is inconsistent. This also mean we can't evolve a selector from unmemoized to memoized:
Because it would be a breaking change. We should stick to a single way to pass the state, and it should be
apiRef
for simplicity & DX. We could preserve passingapiRef.current.state
for compatibility, but move our codebase & the docs to the new style. This could also be done as a breaking change if we want to cleanup the code, but as we're already releasing a lot of breaking changes I'm not sure it would be a good time right now.Somewhat related, right now the selectors show a warning message if the
apiRef.current.state
is passed but the selector is memoized, because selectors use theapiRef.current.instanceId
as a cache key. We should not display warning messages, either accept the arguments or reject them. Or also just add theinstanceId
on the state instead of skipping memoization & warning the user :|Search keywords:
The text was updated successfully, but these errors were encountered: