-
-
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] New internal rows structure for v6 #4927
Conversation
These are the results for the performance tests:
|
This comment was marked as outdated.
This comment was marked as outdated.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I'll merge it next week if no review is added :/ |
It's too complex to review everything. I'm OK with merging it. We'll better see the impacts once we start developing features on top of this new structure. Could you update the description with the breaking changes for the next release? |
I'm disappointed to see that, despite the fact there was no technical reason to break the existing way the updating/setting of rows previously worked, the decision was made to break this. We use DataGridPremium throughout our business ERP software (around 205 data grids or so) and this is a massive PIA for us for seemingly no gain other than personal preference. It's decisions like this that make libraries not friendly for larger projects and it seems like, with every update, this is happening with MUI. Breaking something this substantive "just because" is very poor management in my opinion. |
Closes #4851
Nomenclature
The following names can be discussed, I just think it would be nice to have a common term to describe the concepts.
Data Row: Row provided by the user in
props.rows
/apiRef.current.updateRows
/apiRef.current.setRows
Auto Generated Row: Row created by the grid (can be a footer row for aggregation, a group row for row grouping or tree data, a skeleton row for lazy loading, etc...). Those rows don't have a model.
Row: Element on which we apply sorting / filtering / pagination / etc... and that is rendered by the
GridRow
component (can be either a data row or an auto generated row)Behavior change
We no longer keep the old group expansion when updating the rows through
setRows
orprops.rows
.We now clearly distinguish full dataset update (
setRows
andprops.rows
) and partial dataset update (updateRows
).That part is open for discussion, I like to clearly distinguish the two, but there is no technical limitation to keep the old expansion.
TreeDataLazyLoading
demo is broken until we implement the lazy loading properly (it was a hack which no longer works). The fix should be pretty easy with a new prop similar to AG Grid's isServerSideGroupIn this PR
Row tree format modifications
GridLeafNode
,GridGroupNode
,GridFooterNode
with there own properties, we could have aGridSkeletonNode
in the future)groupNode.childrenFromPath
to be able to see if a path already have a matching child (equivalent to this currentgroupingCriteriaToIdTree
insidebuildRowTree
)Row tree management modifications
Rename
buildRowTree
intocreateRowTree
New method
updateRowTree
New methods
insertDataRowInTree
andremoveDataRowFromTree
These methods are responsible of inserting / removing data rows in the tree.
They take care of creating the missing parents / destroying the empty groups.
They use
insertNodeInTree
andremoveNodeFromTree
internally.New methods
insertNodeInTree
andremoveNodeFromTree
These methods are responsible of inserting / removing node in the tree.
They take care of registering the node inside its parent's children.
Other state structure modifications
Only register the data rows in the lookups / id lists of
state.rows
.state.rows.ids
=>state.rows.dataRowIds
state.rows.idToIdLookup
=>state.rows.dataRowIdToIdLookup
state.rows.idRowsLookup
=>state.rows.dataRowIdToModelLookup
Remove
state.rows.groupingResponseBeforeRowHydration
Hydration of rows now work like hydration of columns and must be able to remove outdated rows.
Replace
state.rows.treeDepth
withstate.rows.treeDepths
This object now contains the amount of nodes of each rows (that way we can now the depth of the tree after a partial update without re-walking the whole tree)
Performance on partial updates using
apiRef.current.updateRows
In future PR(s)
apiRef.current.updateRows
Changelog
Breaking changes
Some selectors related to the rows have been renamed to better described the type of rows they are returning:
The format of the tree nodes (the element accessible in
params.node
or with the methodapiRef.current.getRowNode
) have changed.You have a new
type
property, which can be useful for example to apply custom behavior on groups.Here is an example of the old and new approach to apply a custom value formatter on groups for the grouping column:
(we should rename
gridRowsLookupSelector
=>gridRowsDataRowIdToModelLookupSelector
in another PR to be coherent)