-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Implement tree-based row management #2996
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flaviendelangle
added
component: data grid
This is the name of the generic UI component, not the React module!
core
Infrastructure work going on behind the scenes
labels
Oct 26, 2021
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Oct 28, 2021
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Oct 28, 2021
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Nov 1, 2021
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Nov 1, 2021
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Nov 2, 2021
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Nov 2, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component: data grid
This is the name of the generic UI component, not the React module!
core
Infrastructure work going on behind the scenes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted from #2725
Closes #2813
Contains all the evolution of the existing components / hooks to prepare for the Tree Data and other tree-related features.
Should not contain any behavior change when used with a flat tree.
Performances
Impact on large dataset when Tree Data is not enabled
We have on additional loop over the rows in
getFlatRowTree
to convert to the tree format. It takes ~30ms on my Ryzen 5800X for 100.000 lines so it is not totally painless on very large dataset. I think it is not worth working on it right now, and it won't be trivial because the only solution I see is to allow to store notree
in the state and everywhere we use it take care of the scenario where it is not defined.For all the others children-related selectors / methods that loop over the rows, they should not do it if the
treeDepth === 1
(for instance do not calculate thefilteredDescendantCountLookup
if the tree is flat, it would be a wast of time).Should we sort collapsed children ?
Right now I sort all the rows, even the collapsed children.
But if users have large amount of children, it will spend time sorting all of them even though they are not visible.
Should we leave the collapsed children unsorted and accept that the
apiRef.current.getSortedRows
returns unsorted one for the collapsed ?Main points
useGridRows
Small overhead when the tree is flat (see "Impact on large dataset when Tree Data is not enabled")
All non-throttled updates are done on the list structure
Only generates the tree structure in the throttled update
Major changes to the internal cache structure to avoid useless tree generation
useGridSorting
No overhead when the tree is flat
No state change
useGridFilter
No overhead when the tree is flat
Re-apply the filter when a row is collapsed / expanded
New state key
filteredDescendantCountLookup
to count the descendants passing the filters (allow to display the(6)
below)visibleRows
that is never used, it is the selectorgridVisibleSortedRowEntriesSelector
that generates it. This mean that the sorting and filtering process are now very independent.useCurrentPageRows
With the children, getting the list of the paginated visible rows is not a simple slice anymore.
So I did not want to implement this logic on several files.
This new hook tries to only add the overhead of looking for the children when we have the pagination enabled AND the tree is not flat. That is why I don't use
useGridSelector
in it.