-
-
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
[core] Remove rowsCache
from state
#4480
Conversation
These are the results for the performance tests:
|
8132c6c
to
91854f3
Compare
ids: [], | ||
}, | ||
rowsBeforePartialUpdates: [], | ||
apiRef.current.rowsCache = convertRowsPropToState({ |
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.
If we keep it in the apiRef, what do you think about doing apiRef.current.caches.rows
?
Or apiRef.current.unstable_caches.rows
if we want to keep it private for now.
I would like to move unstable_sanitizedModelOnLastRowTreeCreation
out of the state (same for the equivalent of the Aggregation)
Maybe it's worth scoping it instead of doing it on the root (same for the DOM refs btw)
For the alternative you gave in the PR description, it don't know how we could adapt it in the future to allow custom plugins with there own cache without touching the useDataGridXXXComponent
hook.
But as long as the caches system is private, we can rewrite it to be compatible when we know what the plugins will actually look like
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 went with unstable_caches
. I hope that theme augmentation works to enrich the cache interface to allow custom plugins to have their own cache.
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 should work perfectly
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I think we can go on with this one, #4208 will need a very similar implementation (I did a custom one for now to have something that works) |
Fixes the following TODO by removing the cache from the state and moving it to
apiRef
. In #3896 I added it to the state because was the simplest thing to do.mui-x/packages/grid/x-data-grid/src/hooks/features/rows/useGridRows.ts
Line 127 in b2b9420
I also converted the variables used to track the timeout into refs.
Instead of using
apiRef
, another alternative could be the following: