File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/x-data-grid-pro/src/utils/tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -57,16 +57,20 @@ export const checkGroupChildrenExpansion = (
5757 return false ;
5858 }
5959
60+ // If group existed in previous tree, preserve its expansion state
61+ if ( prevChildrenExpanded !== undefined ) {
62+ return prevChildrenExpanded ;
63+ }
64+
65+ // For new groups, apply default expansion configuration
6066 let childrenExpanded : boolean ;
6167 if ( node . id === GRID_ROOT_GROUP_ID ) {
6268 childrenExpanded = true ;
6369 } else if ( isGroupExpandedByDefault ) {
6470 childrenExpanded = isGroupExpandedByDefault ( node ) ;
6571 } else {
6672 childrenExpanded =
67- defaultGroupingExpansionDepth === - 1 ||
68- defaultGroupingExpansionDepth > node . depth ||
69- ( prevChildrenExpanded ?? false ) ;
73+ defaultGroupingExpansionDepth === - 1 || defaultGroupingExpansionDepth > node . depth ;
7074 }
7175
7276 return childrenExpanded ;
You can’t perform that action at this time.
0 commit comments