@mui/x-data-grid-pro 8.14.1 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,213 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.16.0
9
+
10
+ _Oct 29, 2025_
11
+
12
+ We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🖌️ Add `brush` zoom interaction to charts
15
+ - 🔁 [Server-side update](https://mui.com/x/react-data-grid/server-side-data/#updating-server-side-data) in a grid with tree data/row grouping and aggregation will trigger re-fetch for all parent levels of that row to update aggregated values. See the [demo](https://mui.com/x/react-data-grid/server-side-data/aggregation/#usage-with-tree-data).
16
+
17
+ Special thanks go out to the community members for their valuable contributions:
18
+ @felix-wg, @frncesc, @sai6855
19
+
20
+ The following are all team members who have contributed to this release:
21
+ @alexfauquette, @arminmeh, @bernardobelchior, @brijeshb42, @flaviendelangle, @JCQuintas, @MBilalShafi, @mbrookes, @michelengelen, @noraleonte, @rita-codes
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@8.16.0`
26
+
27
+ - [DataGrid] Ignore `Ctrl+A` key combination for the row selection in the community version (#20110) @felix-wg
28
+ - [DataGrid][l10n] Improve Spanish (es-ES) locale (#20134) @frncesc
29
+
30
+ #### `@mui/x-data-grid-pro@8.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@8.16.0`, plus:
33
+
34
+ - [DataGridPro] Add explicit return type to `getVisibleRowsLookup()` to fix the build with `tsc` (#20116) @arminmeh
35
+ - [DataGridPro] Retain the expansion state with expansion configuration props (#20126) @MBilalShafi
36
+
37
+ #### `@mui/x-data-grid-premium@8.16.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
38
+
39
+ Same changes as in `@mui/x-data-grid-pro@8.16.0`, plus:
40
+
41
+ - [DataGridPremium] Export and restore chart integration state (#20079) @arminmeh
42
+ - [DataGridPremium] Fix grouping column `valueFormatter()` crash (#20070) @sai6855
43
+ - [DataGridPremium] Refetch aggregation data after row update with server-side aggregation (#20039) @arminmeh
44
+
45
+ ### Date and Time Pickers
46
+
47
+ #### `@mui/x-date-pickers@8.16.0`
48
+
49
+ - [pickers] Prevent blur event propagation on individual sections (#19825) @michelengelen
50
+
51
+ #### `@mui/x-date-pickers-pro@8.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@8.16.0`.
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@8.16.0`
58
+
59
+ - [charts] Allow tooltip to anchor items (#19954) @alexfauquette
60
+ - [charts] Fix behavior of grouped axis (#20118) @JCQuintas
61
+ - [charts] Move scale symlog inside scales (#20137) @JCQuintas
62
+ - [charts] Fix AreaChartConnectNulls demo height not correctly resizing (#20078) @sai6855
63
+ - [charts] Fix charts resizing overflow (#20080) @alexfauquette
64
+ - [charts] Fix tooltip not showing on first render (#20115) @bernardobelchior
65
+ - [charts] Handle `undefined` id and color in series (#20087) @bernardobelchior
66
+ - [charts] Remove `useMemo` from isZoomOn*Enabled and isPanOn*Enabled hooks (#20132) @Copilot
67
+ - [charts] Use static data for perf (#20072) @JCQuintas
68
+ - [charts] Move scale symlog inside scales (#20137) @JCQuintas
69
+
70
+ #### `@mui/x-charts-pro@8.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
71
+
72
+ Same changes as in `@mui/x-charts@8.16.0`, plus:
73
+
74
+ - [charts-pro] Add `brush` zoom interaction (#19899) @JCQuintas
75
+ - [charts-pro] Add sankey performance check (#20069) @JCQuintas
76
+
77
+ #### `@mui/x-charts-premium@8.16.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
78
+
79
+ Same changes as in `@mui/x-charts-pro@8.16.0`.
80
+
81
+ ### Tree View
82
+
83
+ #### `@mui/x-tree-view@8.16.0`
84
+
85
+ Internal changes.
86
+
87
+ #### `@mui/x-tree-view-pro@8.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
88
+
89
+ Same changes as in `@mui/x-tree-view@8.16.0`.
90
+
91
+ ### Codemod
92
+
93
+ #### `@mui/x-codemod@8.16.0`
94
+
95
+ Internal changes.
96
+
97
+ ### Core
98
+
99
+ - [code-infra] Setup eslint compat plugin (#20105) @brijeshb42
100
+ - [code-infra] Improve store types (#20129) @JCQuintas
101
+ - [docs] Update the callout in `rows` prop documentation (#20127) @MBilalShafi
102
+ - [docs-infra] Refine changelog contributor acknowledgment messages (#20123) @mbrookes
103
+
104
+ ### Miscellaneous
105
+
106
+ - [x-telemetry] Skip telemetry tests on browser mode (#20122) @bernardobelchior
107
+
108
+ ## 8.15.0
109
+
110
+ _Oct 23, 2025_
111
+
112
+ We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
113
+
114
+ - 🖌️ Add new [`brush` charts interaction](https://mui.com/x/react-charts/brush/) for building custom behavior.
115
+ ![brush visualization example](https://github.com/user-attachments/assets/60c382a1-e418-4736-8dcb-1567c4e361e3)
116
+ - ⚡️ Performance improvements for large bar charts
117
+ - 🤖 Data Grid AI assistant can now [visualize the query results](https://mui.com/x/react-data-grid/ai-assistant/#data-visualization) by controlling the chart integration settings
118
+ - 📦 DataGrid uses an internal MUI fork of ExcelJS that does not depend on vulnerable versions of NPM packages
119
+ - 🐞 Bugfixes
120
+ - 📚 Documentation improvements
121
+
122
+ Special thanks go out to the community members for their valuable contributions:
123
+ @ZagrebaAlex
124
+
125
+ The following are all team members who have contributed to this release:
126
+ @alexfauquette, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @KenanYusuf, @prakhargupta1, @rita-codes, @siriwatknp, @arminmeh, @brijeshb42, @noraleonte
127
+
128
+ ### Data Grid
129
+
130
+ #### `@mui/x-data-grid@8.15.0`
131
+
132
+ - [DataGrid] Fix `dataSource.fetchRows` API's return type (#20068) @arminmeh
133
+
134
+ #### `@mui/x-data-grid-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
135
+
136
+ Same changes as in `@mui/x-data-grid@8.15.0`, plus:
137
+
138
+ - [DataGridPro] Keep children in the tree after parent row is re-fetched with the data source (#19934) @arminmeh
139
+ - [DataGridPro] Support scroll shadows customization (#19982) @KenanYusuf
140
+
141
+ #### `@mui/x-data-grid-premium@8.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
142
+
143
+ Same changes as in `@mui/x-data-grid-pro@8.15.0`, plus:
144
+
145
+ - [DataGridPremium] Use ExcelJS fork (#19796) @cherniavskii
146
+ - [DataGridPremium] Support data visualization in AI Assistant (#19831) @arminmeh
147
+
148
+ ### Date and Time Pickers
149
+
150
+ #### `@mui/x-date-pickers@8.15.0`
151
+
152
+ Internal changes.
153
+
154
+ #### `@mui/x-date-pickers-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
155
+
156
+ Same changes as in `@mui/x-date-pickers@8.15.0`.
157
+
158
+ ### Charts
159
+
160
+ #### `@mui/x-charts@8.15.0`
161
+
162
+ - [charts] Add `ChartsBrushOverlay` and allow brush configuration (#19956) @JCQuintas
163
+ - [charts] Add `getStringSize` benchmark. Remove benchmarks from built package. (#19995) @bernardobelchior
164
+ - [charts] Batch string size measurement (#19994) @bernardobelchior
165
+ - [charts] Fix console issue (#20025) @JCQuintas
166
+ - [charts] Fix is[ZoomFeature]Enabled type (#20058) @alexfauquette
167
+ - [charts] Fix reference line middle spacing (#20004) @JCQuintas
168
+ - [charts] Improve `getStringSize` and `batchMeasureStrings` performance (#19996) @bernardobelchior
169
+ - [charts] Improve deep export script (#20007) @JCQuintas
170
+ - [charts] Improve string measurement benchmarks (#19999) @bernardobelchior
171
+ - [charts] Measure string sizes using SVG elements (#19981) @bernardobelchior
172
+ - [l10n] Improve Greek (gr-GR) locale (#20060) @ZagrebaAlex
173
+
174
+ #### `@mui/x-charts-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
175
+
176
+ Same changes as in `@mui/x-charts@8.15.0`, plus:
177
+
178
+ - [charts-pro] Fix pan with `axis.reverse` (#20031) @JCQuintas
179
+
180
+ #### `@mui/x-charts-premium@8.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
181
+
182
+ Same changes as in `@mui/x-charts-pro@8.15.0`.
183
+
184
+ ### Tree View
185
+
186
+ #### `@mui/x-tree-view@8.15.0`
187
+
188
+ - [tree view] Multi character type-ahead (#19942) @noraleonte
189
+
190
+ #### `@mui/x-tree-view-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
191
+
192
+ Same changes as in `@mui/x-tree-view@8.15.0`.
193
+
194
+ ### Codemod
195
+
196
+ #### `@mui/x-codemod@8.14.0`
197
+
198
+ Internal changes.
199
+
200
+ ### Docs
201
+
202
+ - [docs] Add overview section for scatter chart and heatmap (#19888) @prakhargupta1
203
+ - [docs] Add charts bell curve example (#20003) @JCQuintas
204
+ - [docs] Add grouped multiple fields for Data Grid row grouping recipe (#19964) @siriwatknp
205
+ - [docs] Add Data Grid loading state recipe (#19958) @siriwatknp
206
+
207
+ ### Core
208
+
209
+ - [code-infra] Remove @mui/monorepo usage for react versioning (#19894) @Janpot
210
+ - [code-infra] Remove invalid `environment: 'browser'` from vitest browser config (#19993) @bernardobelchior
211
+ - [code-infra] Remove unused babel aliases (#19987) @Janpot
212
+ - [code-infra] Turn on all testing-library eslint rules (#19946) @brijeshb42
213
+ - [docs-infra] Fix broken hash link (#20062) @Janpot
214
+
8
215
  ## 8.14.1
9
216
 
10
217
  _Oct 16, 2025_
@@ -28,11 +28,12 @@ const configuration = {
28
28
  useGridRowAriaAttributes: _useGridRowAriaAttributes.useGridRowAriaAttributesPro,
29
29
  useGridRowsOverridableMethods: _internals.useGridRowsOverridableMethods,
30
30
  useGridParamsOverridableMethods: _internals.useGridParamsOverridableMethods,
31
+ useIsCellEditable: _internals.useIsCellEditable,
31
32
  useCellAggregationResult: () => null,
32
33
  useFilterValueGetter: apiRef => apiRef.current.getRowValue
33
34
  }
34
35
  };
35
- const releaseInfo = "MTc2MDU3MjgwMDAwMA==";
36
+ const releaseInfo = "MTc2MTY5NjAwMDAwMA==";
36
37
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
37
38
  packageName: "x-data-grid-pro",
38
39
  releaseInfo: releaseInfo
@@ -93,7 +93,7 @@ const useDataGridProComponent = (apiRef, props, configuration) => {
93
93
  (0, _useGridDetailPanel.useGridDetailPanel)(apiRef, props);
94
94
  (0, _internals.useGridColumnSpanning)(apiRef);
95
95
  (0, _internals.useGridColumnGrouping)(apiRef, props);
96
- (0, _internals.useGridEditing)(apiRef, props);
96
+ (0, _internals.useGridEditing)(apiRef, props, configuration);
97
97
  (0, _internals.useGridFocus)(apiRef, props);
98
98
  (0, _internals.useGridPreferencesPanel)(apiRef, props);
99
99
  (0, _internals.useGridFilter)(apiRef, props, configuration);
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useLicenseVerifier, Watermark } from '@mui/x-license';
7
7
  import { GridRoot, GridContextProvider } from '@mui/x-data-grid';
8
- import { validateProps, useGridApiInitialization, useGridRowsOverridableMethods, useGridParamsOverridableMethods } from '@mui/x-data-grid/internals';
8
+ import { validateProps, useGridApiInitialization, useGridRowsOverridableMethods, useGridParamsOverridableMethods, useIsCellEditable } from '@mui/x-data-grid/internals';
9
9
  import { useMaterialCSSVariables } from '@mui/x-data-grid/material';
10
10
  import { forwardRef } from '@mui/x-internals/forwardRef';
11
11
  import { useDataGridProComponent } from "./useDataGridProComponent.js";
@@ -21,11 +21,12 @@ const configuration = {
21
21
  useGridRowAriaAttributes: useGridRowAriaAttributesPro,
22
22
  useGridRowsOverridableMethods,
23
23
  useGridParamsOverridableMethods,
24
+ useIsCellEditable,
24
25
  useCellAggregationResult: () => null,
25
26
  useFilterValueGetter: apiRef => apiRef.current.getRowValue
26
27
  }
27
28
  };
28
- const releaseInfo = "MTc2MDU3MjgwMDAwMA==";
29
+ const releaseInfo = "MTc2MTY5NjAwMDAwMA==";
29
30
  const watermark = /*#__PURE__*/_jsx(Watermark, {
30
31
  packageName: "x-data-grid-pro",
31
32
  releaseInfo: releaseInfo
@@ -86,7 +86,7 @@ export const useDataGridProComponent = (apiRef, props, configuration) => {
86
86
  useGridDetailPanel(apiRef, props);
87
87
  useGridColumnSpanning(apiRef);
88
88
  useGridColumnGrouping(apiRef, props);
89
- useGridEditing(apiRef, props);
89
+ useGridEditing(apiRef, props, configuration);
90
90
  useGridFocus(apiRef, props);
91
91
  useGridPreferencesPanel(apiRef, props);
92
92
  useGridFilter(apiRef, props, configuration);
@@ -1,5 +1,5 @@
1
1
  import type { GridValidRowModel, GridRowId, GridGetRowsResponse, GridDataSource, GridGetRowsParams } from '@mui/x-data-grid';
2
- import type { GridDataSourceApiBase } from '@mui/x-data-grid/internals';
2
+ import type { GridDataSourceApiBase, GridDataSourceFetchRowsParams } from '@mui/x-data-grid/internals';
3
3
  export interface GridDataSourceState {
4
4
  loading: Record<GridRowId, boolean>;
5
5
  errors: Record<GridRowId, any>;
@@ -42,9 +42,10 @@ export interface GridDataSourceApiBasePro extends Omit<GridDataSourceApiBase, 'f
42
42
  * If no `parentId` option is provided, it fetches the root rows.
43
43
  * Any missing parameter from `params` will be filled from the state (sorting, filtering, etc.).
44
44
  * @param {GridRowId} parentId The id of the parent node (default: `GRID_ROOT_GROUP_ID`).
45
- * @param {Partial<GridGetRowsParamsPro>} params Request parameters override.
45
+ * @param {GridDataSourceFetchRowsParams<GridGetRowsParamsPro>} params Request parameters override.
46
+ * @returns {Promise<void>} A promise that resolves when the rows are fetched.
46
47
  */
47
- fetchRows: (parentId?: GridRowId, params?: Partial<GridGetRowsParamsPro>) => void;
48
+ fetchRows: (parentId?: GridRowId, params?: GridDataSourceFetchRowsParams<GridGetRowsParamsPro>) => Promise<void>;
48
49
  /**
49
50
  * Set the loading state of a parent row.
50
51
  * @param {string} parentId The id of the parent node.
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridRowId } from '@mui/x-data-grid';
3
- import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions } from '@mui/x-data-grid/internals';
3
+ import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions, GridStrategyProcessor } from '@mui/x-data-grid/internals';
4
4
  import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
5
5
  import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
6
6
  import { GridDataSourceApiPro, GridDataSourcePrivateApiPro } from "./models.js";
@@ -13,11 +13,16 @@ export declare const useGridDataSourceBasePro: <Api extends GridPrivateApiPro>(a
13
13
  public: GridDataSourceApiPro;
14
14
  private: GridDataSourcePrivateApiPro;
15
15
  };
16
- debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("@mui/x-data-grid/hooks/features/dataSource/models").GridDataSourceFetchRowsParams) => void) & import("@mui/utils/debounce").Cancelable;
17
- strategyProcessor: {
16
+ debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("@mui/x-data-grid/internals").GridDataSourceFetchRowsParams<import("@mui/x-data-grid").GridGetRowsParams>) => Promise<void>) & import("@mui/utils/debounce").Cancelable;
17
+ flatTreeStrategyProcessor: {
18
18
  strategyName: DataSourceRowsUpdateStrategy;
19
19
  group: "dataSourceRowsUpdate";
20
- processor: import("@mui/x-data-grid/internals").GridStrategyProcessor<"dataSourceRowsUpdate">;
20
+ processor: GridStrategyProcessor<"dataSourceRowsUpdate">;
21
+ };
22
+ groupedDataStrategyProcessor: {
23
+ strategyName: DataSourceRowsUpdateStrategy;
24
+ group: "dataSourceRowsUpdate";
25
+ processor: GridStrategyProcessor<"dataSourceRowsUpdate">;
21
26
  };
22
27
  events: {
23
28
  strategyAvailabilityChange: import("@mui/x-data-grid").GridEventListener<"strategyAvailabilityChange">;
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
6
6
  import useLazyRef from '@mui/utils/useLazyRef';
7
- import { useGridSelector, GridGetRowsError, gridRowIdSelector, gridRowNodeSelector, gridRowTreeSelector } from '@mui/x-data-grid';
8
- import { gridRowGroupsToFetchSelector, useGridDataSourceBase, CacheChunkManager, gridGetRowsParamsSelector, DataSourceRowsUpdateStrategy, GridStrategyGroup } from '@mui/x-data-grid/internals';
7
+ import { useGridSelector, GridGetRowsError, gridRowIdSelector, gridRowNodeSelector, gridRowTreeSelector, GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
8
+ import { gridRowGroupsToFetchSelector, useGridDataSourceBase, CacheChunkManager, gridGetRowsParamsSelector, DataSourceRowsUpdateStrategy, GridStrategyGroup, getTreeNodeDescendants } from '@mui/x-data-grid/internals';
9
9
  import { warnOnce } from '@mui/x-internals/warning';
10
10
  import { NestedDataManager, RequestStatus, getGroupKeys } from "./utils.js";
11
11
  import { gridDataSourceErrorsSelector } from "./gridDataSourceSelector.js";
@@ -37,7 +37,7 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
37
37
  const {
38
38
  api,
39
39
  debouncedFetchRows,
40
- strategyProcessor,
40
+ strategyProcessor: flatTreeStrategyProcessor,
41
41
  events,
42
42
  cacheChunkManager,
43
43
  cache
@@ -47,8 +47,9 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
47
47
  handleEditRow
48
48
  }, options));
49
49
  const setStrategyAvailability = React.useCallback(() => {
50
- apiRef.current.setStrategyAvailability(GridStrategyGroup.DataSource, DataSourceRowsUpdateStrategy.Default, props.dataSource && !props.lazyLoading ? () => true : () => false);
51
- }, [apiRef, props.dataSource, props.lazyLoading]);
50
+ const targetStrategy = props.treeData ? DataSourceRowsUpdateStrategy.GroupedData : DataSourceRowsUpdateStrategy.Default;
51
+ apiRef.current.setStrategyAvailability(GridStrategyGroup.DataSource, targetStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
52
+ }, [apiRef, props.dataSource, props.lazyLoading, props.treeData]);
52
53
  const onDataSourceErrorProp = props.onDataSourceError;
53
54
  const fetchRowChildren = React.useCallback(async id => {
54
55
  const pipedParams = apiRef.current.unstable_applyPipeProcessors('getRowsParams', {});
@@ -205,6 +206,55 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
205
206
  apiRef.current.updateNestedRows(removedRows, rowNode.path);
206
207
  }
207
208
  }, [apiRef]);
209
+ const handleGroupedDataUpdate = React.useCallback(params => {
210
+ if ('error' in params) {
211
+ apiRef.current.setRows([]);
212
+ return;
213
+ }
214
+ const {
215
+ response,
216
+ options: {
217
+ keepChildrenExpanded
218
+ }
219
+ } = params;
220
+ if (response.rowCount !== undefined) {
221
+ apiRef.current.setRowCount(response.rowCount);
222
+ }
223
+ if (keepChildrenExpanded === false) {
224
+ apiRef.current.setRows(response.rows);
225
+ } else {
226
+ const tree = gridRowTreeSelector(apiRef);
227
+ // Remove existing outdated rows before setting the new ones
228
+ // Create a set of the current root rows
229
+ const parentRowsToDelete = new Set(getTreeNodeDescendants(tree, GRID_ROOT_GROUP_ID, false, true));
230
+ // Remove from the list the rows that are again in the response
231
+ response.rows.forEach(row => {
232
+ parentRowsToDelete.delete(gridRowIdSelector(apiRef, row));
233
+ });
234
+ const rowsToDelete = [];
235
+ if (parentRowsToDelete.size > 0) {
236
+ parentRowsToDelete.forEach(parentRowId => {
237
+ const descendants = getTreeNodeDescendants(tree, parentRowId, false, false);
238
+ for (let i = descendants.length - 1; i >= 0; i -= 1) {
239
+ // delete deepest descendants first
240
+ rowsToDelete.push({
241
+ id: descendants[i],
242
+ _action: 'delete'
243
+ });
244
+ }
245
+ rowsToDelete.push({
246
+ id: parentRowId,
247
+ _action: 'delete'
248
+ });
249
+ });
250
+ }
251
+ apiRef.current.updateRows(response.rows.concat(rowsToDelete));
252
+ }
253
+ apiRef.current.unstable_applyPipeProcessors('processDataSourceRows', {
254
+ params: params.fetchParams,
255
+ response
256
+ }, true);
257
+ }, [apiRef]);
208
258
  const dataSourceApi = {
209
259
  dataSource: _extends({}, api.public.dataSource, {
210
260
  setChildrenLoading,
@@ -229,7 +279,12 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
229
279
  private: dataSourcePrivateApi
230
280
  },
231
281
  debouncedFetchRows,
232
- strategyProcessor,
282
+ flatTreeStrategyProcessor,
283
+ groupedDataStrategyProcessor: {
284
+ strategyName: DataSourceRowsUpdateStrategy.GroupedData,
285
+ group: 'dataSourceRowsUpdate',
286
+ processor: handleGroupedDataUpdate
287
+ },
233
288
  events,
234
289
  setStrategyAvailability,
235
290
  cacheChunkManager,
@@ -21,13 +21,15 @@ const options = {
21
21
  export const useGridDataSourcePro = (apiRef, props) => {
22
22
  const {
23
23
  api,
24
- strategyProcessor,
24
+ flatTreeStrategyProcessor,
25
+ groupedDataStrategyProcessor,
25
26
  events,
26
27
  setStrategyAvailability
27
28
  } = useGridDataSourceBasePro(apiRef, props, options);
28
29
  useGridApiMethod(apiRef, api.public, 'public');
29
30
  useGridApiMethod(apiRef, api.private, 'private');
30
- useGridRegisterStrategyProcessor(apiRef, strategyProcessor.strategyName, strategyProcessor.group, strategyProcessor.processor);
31
+ useGridRegisterStrategyProcessor(apiRef, flatTreeStrategyProcessor.strategyName, flatTreeStrategyProcessor.group, flatTreeStrategyProcessor.processor);
32
+ useGridRegisterStrategyProcessor(apiRef, groupedDataStrategyProcessor.strategyName, groupedDataStrategyProcessor.group, groupedDataStrategyProcessor.processor);
31
33
  Object.entries(events).forEach(([event, handler]) => {
32
34
  addEventHandler(apiRef, event, handler);
33
35
  });
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.14.1
2
+ * @mui/x-data-grid-pro v8.16.0
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -25,6 +25,7 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
25
25
  export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
26
26
  export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
27
27
  export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
28
+ export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
28
29
  export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue } from "../models/dataGridProProps.js";
29
30
  export type { GridProSlotProps } from "../models/gridProSlotProps.js";
30
31
  export { createRowTree } from "../utils/tree/createRowTree.js";
@@ -28,6 +28,7 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
28
28
  export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
29
29
  export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
30
30
  export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
31
+ export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
31
32
  export { createRowTree } from "../utils/tree/createRowTree.js";
32
33
  export { updateRowTree } from "../utils/tree/updateRowTree.js";
33
34
  export { sortRowTree } from "../utils/tree/sortRowTree.js";
@@ -2,6 +2,7 @@ import { GridFilterState, GridGroupNode, GridRowId, GridRowTreeConfig, GridRowsS
2
2
  import { GridTreeDepths } from '@mui/x-data-grid/internals';
3
3
  import { RowTreeBuilderGroupingCriterion } from "./models.js";
4
4
  import { DataGridProProps } from "../../models/dataGridProProps.js";
5
+ import type { GridStatePro } from "../../models/gridStatePro.js";
5
6
  export declare const getGroupRowIdFromPath: (path: RowTreeBuilderGroupingCriterion[]) => string;
6
7
  export declare const getNodePathInTree: ({
7
8
  id,
@@ -50,4 +51,4 @@ export declare const getVisibleRowsLookup: ({
50
51
  }: {
51
52
  tree: GridRowsState["tree"];
52
53
  filteredRowsLookup: GridFilterState["filteredRowsLookup"];
53
- }) => import("@mui/x-data-grid/hooks/features/filter/gridFilterState").GridVisibleRowsLookupState;
54
+ }) => GridStatePro["visibleRowsLookup"];
@@ -24,13 +24,20 @@ export const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth,
24
24
  if (maxDepth !== undefined && node.depth >= maxDepth) {
25
25
  return false;
26
26
  }
27
+
28
+ // If group existed in previous tree, preserve its expansion state
29
+ if (prevChildrenExpanded !== undefined) {
30
+ return prevChildrenExpanded;
31
+ }
32
+
33
+ // For new groups, apply default expansion configuration
27
34
  let childrenExpanded;
28
35
  if (node.id === GRID_ROOT_GROUP_ID) {
29
36
  childrenExpanded = true;
30
37
  } else if (isGroupExpandedByDefault) {
31
38
  childrenExpanded = isGroupExpandedByDefault(node);
32
39
  } else {
33
- childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth || (prevChildrenExpanded ?? false);
40
+ childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth;
34
41
  }
35
42
  return childrenExpanded;
36
43
  };
@@ -1,5 +1,5 @@
1
1
  import type { GridValidRowModel, GridRowId, GridGetRowsResponse, GridDataSource, GridGetRowsParams } from '@mui/x-data-grid';
2
- import type { GridDataSourceApiBase } from '@mui/x-data-grid/internals';
2
+ import type { GridDataSourceApiBase, GridDataSourceFetchRowsParams } from '@mui/x-data-grid/internals';
3
3
  export interface GridDataSourceState {
4
4
  loading: Record<GridRowId, boolean>;
5
5
  errors: Record<GridRowId, any>;
@@ -42,9 +42,10 @@ export interface GridDataSourceApiBasePro extends Omit<GridDataSourceApiBase, 'f
42
42
  * If no `parentId` option is provided, it fetches the root rows.
43
43
  * Any missing parameter from `params` will be filled from the state (sorting, filtering, etc.).
44
44
  * @param {GridRowId} parentId The id of the parent node (default: `GRID_ROOT_GROUP_ID`).
45
- * @param {Partial<GridGetRowsParamsPro>} params Request parameters override.
45
+ * @param {GridDataSourceFetchRowsParams<GridGetRowsParamsPro>} params Request parameters override.
46
+ * @returns {Promise<void>} A promise that resolves when the rows are fetched.
46
47
  */
47
- fetchRows: (parentId?: GridRowId, params?: Partial<GridGetRowsParamsPro>) => void;
48
+ fetchRows: (parentId?: GridRowId, params?: GridDataSourceFetchRowsParams<GridGetRowsParamsPro>) => Promise<void>;
48
49
  /**
49
50
  * Set the loading state of a parent row.
50
51
  * @param {string} parentId The id of the parent node.
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridRowId } from '@mui/x-data-grid';
3
- import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions } from '@mui/x-data-grid/internals';
3
+ import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions, GridStrategyProcessor } from '@mui/x-data-grid/internals';
4
4
  import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
5
5
  import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
6
6
  import { GridDataSourceApiPro, GridDataSourcePrivateApiPro } from "./models.js";
@@ -13,11 +13,16 @@ export declare const useGridDataSourceBasePro: <Api extends GridPrivateApiPro>(a
13
13
  public: GridDataSourceApiPro;
14
14
  private: GridDataSourcePrivateApiPro;
15
15
  };
16
- debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("@mui/x-data-grid/hooks/features/dataSource/models").GridDataSourceFetchRowsParams) => void) & import("@mui/utils/debounce").Cancelable;
17
- strategyProcessor: {
16
+ debouncedFetchRows: ((parentId?: import("@mui/x-data-grid").GridRowId, params?: import("@mui/x-data-grid/internals").GridDataSourceFetchRowsParams<import("@mui/x-data-grid").GridGetRowsParams>) => Promise<void>) & import("@mui/utils/debounce").Cancelable;
17
+ flatTreeStrategyProcessor: {
18
18
  strategyName: DataSourceRowsUpdateStrategy;
19
19
  group: "dataSourceRowsUpdate";
20
- processor: import("@mui/x-data-grid/internals").GridStrategyProcessor<"dataSourceRowsUpdate">;
20
+ processor: GridStrategyProcessor<"dataSourceRowsUpdate">;
21
+ };
22
+ groupedDataStrategyProcessor: {
23
+ strategyName: DataSourceRowsUpdateStrategy;
24
+ group: "dataSourceRowsUpdate";
25
+ processor: GridStrategyProcessor<"dataSourceRowsUpdate">;
21
26
  };
22
27
  events: {
23
28
  strategyAvailabilityChange: import("@mui/x-data-grid").GridEventListener<"strategyAvailabilityChange">;
@@ -44,7 +44,7 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
44
44
  const {
45
45
  api,
46
46
  debouncedFetchRows,
47
- strategyProcessor,
47
+ strategyProcessor: flatTreeStrategyProcessor,
48
48
  events,
49
49
  cacheChunkManager,
50
50
  cache
@@ -54,8 +54,9 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
54
54
  handleEditRow
55
55
  }, options));
56
56
  const setStrategyAvailability = React.useCallback(() => {
57
- apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, _internals.DataSourceRowsUpdateStrategy.Default, props.dataSource && !props.lazyLoading ? () => true : () => false);
58
- }, [apiRef, props.dataSource, props.lazyLoading]);
57
+ const targetStrategy = props.treeData ? _internals.DataSourceRowsUpdateStrategy.GroupedData : _internals.DataSourceRowsUpdateStrategy.Default;
58
+ apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, targetStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
59
+ }, [apiRef, props.dataSource, props.lazyLoading, props.treeData]);
59
60
  const onDataSourceErrorProp = props.onDataSourceError;
60
61
  const fetchRowChildren = React.useCallback(async id => {
61
62
  const pipedParams = apiRef.current.unstable_applyPipeProcessors('getRowsParams', {});
@@ -212,6 +213,55 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
212
213
  apiRef.current.updateNestedRows(removedRows, rowNode.path);
213
214
  }
214
215
  }, [apiRef]);
216
+ const handleGroupedDataUpdate = React.useCallback(params => {
217
+ if ('error' in params) {
218
+ apiRef.current.setRows([]);
219
+ return;
220
+ }
221
+ const {
222
+ response,
223
+ options: {
224
+ keepChildrenExpanded
225
+ }
226
+ } = params;
227
+ if (response.rowCount !== undefined) {
228
+ apiRef.current.setRowCount(response.rowCount);
229
+ }
230
+ if (keepChildrenExpanded === false) {
231
+ apiRef.current.setRows(response.rows);
232
+ } else {
233
+ const tree = (0, _xDataGrid.gridRowTreeSelector)(apiRef);
234
+ // Remove existing outdated rows before setting the new ones
235
+ // Create a set of the current root rows
236
+ const parentRowsToDelete = new Set((0, _internals.getTreeNodeDescendants)(tree, _xDataGrid.GRID_ROOT_GROUP_ID, false, true));
237
+ // Remove from the list the rows that are again in the response
238
+ response.rows.forEach(row => {
239
+ parentRowsToDelete.delete((0, _xDataGrid.gridRowIdSelector)(apiRef, row));
240
+ });
241
+ const rowsToDelete = [];
242
+ if (parentRowsToDelete.size > 0) {
243
+ parentRowsToDelete.forEach(parentRowId => {
244
+ const descendants = (0, _internals.getTreeNodeDescendants)(tree, parentRowId, false, false);
245
+ for (let i = descendants.length - 1; i >= 0; i -= 1) {
246
+ // delete deepest descendants first
247
+ rowsToDelete.push({
248
+ id: descendants[i],
249
+ _action: 'delete'
250
+ });
251
+ }
252
+ rowsToDelete.push({
253
+ id: parentRowId,
254
+ _action: 'delete'
255
+ });
256
+ });
257
+ }
258
+ apiRef.current.updateRows(response.rows.concat(rowsToDelete));
259
+ }
260
+ apiRef.current.unstable_applyPipeProcessors('processDataSourceRows', {
261
+ params: params.fetchParams,
262
+ response
263
+ }, true);
264
+ }, [apiRef]);
215
265
  const dataSourceApi = {
216
266
  dataSource: (0, _extends2.default)({}, api.public.dataSource, {
217
267
  setChildrenLoading,
@@ -236,7 +286,12 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
236
286
  private: dataSourcePrivateApi
237
287
  },
238
288
  debouncedFetchRows,
239
- strategyProcessor,
289
+ flatTreeStrategyProcessor,
290
+ groupedDataStrategyProcessor: {
291
+ strategyName: _internals.DataSourceRowsUpdateStrategy.GroupedData,
292
+ group: 'dataSourceRowsUpdate',
293
+ processor: handleGroupedDataUpdate
294
+ },
240
295
  events,
241
296
  setStrategyAvailability,
242
297
  cacheChunkManager,
@@ -29,13 +29,15 @@ const options = {
29
29
  const useGridDataSourcePro = (apiRef, props) => {
30
30
  const {
31
31
  api,
32
- strategyProcessor,
32
+ flatTreeStrategyProcessor,
33
+ groupedDataStrategyProcessor,
33
34
  events,
34
35
  setStrategyAvailability
35
36
  } = (0, _useGridDataSourceBasePro.useGridDataSourceBasePro)(apiRef, props, options);
36
37
  (0, _xDataGrid.useGridApiMethod)(apiRef, api.public, 'public');
37
38
  (0, _xDataGrid.useGridApiMethod)(apiRef, api.private, 'private');
38
- (0, _internals.useGridRegisterStrategyProcessor)(apiRef, strategyProcessor.strategyName, strategyProcessor.group, strategyProcessor.processor);
39
+ (0, _internals.useGridRegisterStrategyProcessor)(apiRef, flatTreeStrategyProcessor.strategyName, flatTreeStrategyProcessor.group, flatTreeStrategyProcessor.processor);
40
+ (0, _internals.useGridRegisterStrategyProcessor)(apiRef, groupedDataStrategyProcessor.strategyName, groupedDataStrategyProcessor.group, groupedDataStrategyProcessor.processor);
39
41
  Object.entries(events).forEach(([event, handler]) => {
40
42
  (0, _xDataGrid.useGridEvent)(apiRef, event, handler);
41
43
  });
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.14.1
2
+ * @mui/x-data-grid-pro v8.16.0
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -25,6 +25,7 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
25
25
  export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
26
26
  export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
27
27
  export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
28
+ export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
28
29
  export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue } from "../models/dataGridProProps.js";
29
30
  export type { GridProSlotProps } from "../models/gridProSlotProps.js";
30
31
  export { createRowTree } from "../utils/tree/createRowTree.js";
@@ -37,6 +37,7 @@ var _exportNames = {
37
37
  useGridDataSourceBasePro: true,
38
38
  gridDataSourceErrorSelector: true,
39
39
  gridDataSourceLoadingIdSelector: true,
40
+ getGroupKeys: true,
40
41
  createRowTree: true,
41
42
  updateRowTree: true,
42
43
  sortRowTree: true,
@@ -96,16 +97,22 @@ Object.defineProperty(exports, "detailPanelStateInitializer", {
96
97
  return _useGridDetailPanel.detailPanelStateInitializer;
97
98
  }
98
99
  });
100
+ Object.defineProperty(exports, "getGroupKeys", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _utils.getGroupKeys;
104
+ }
105
+ });
99
106
  Object.defineProperty(exports, "getParentPath", {
100
107
  enumerable: true,
101
108
  get: function () {
102
- return _utils2.getParentPath;
109
+ return _utils3.getParentPath;
103
110
  }
104
111
  });
105
112
  Object.defineProperty(exports, "getVisibleRowsLookup", {
106
113
  enumerable: true,
107
114
  get: function () {
108
- return _utils.getVisibleRowsLookup;
115
+ return _utils2.getVisibleRowsLookup;
109
116
  }
110
117
  });
111
118
  Object.defineProperty(exports, "gridDataSourceErrorSelector", {
@@ -123,13 +130,13 @@ Object.defineProperty(exports, "gridDataSourceLoadingIdSelector", {
123
130
  Object.defineProperty(exports, "insertNodeInTree", {
124
131
  enumerable: true,
125
132
  get: function () {
126
- return _utils.insertNodeInTree;
133
+ return _utils2.insertNodeInTree;
127
134
  }
128
135
  });
129
136
  Object.defineProperty(exports, "removeNodeFromTree", {
130
137
  enumerable: true,
131
138
  get: function () {
132
- return _utils.removeNodeFromTree;
139
+ return _utils2.removeNodeFromTree;
133
140
  }
134
141
  });
135
142
  Object.defineProperty(exports, "rowPinningStateInitializer", {
@@ -147,13 +154,13 @@ Object.defineProperty(exports, "rowReorderStateInitializer", {
147
154
  Object.defineProperty(exports, "skipFiltering", {
148
155
  enumerable: true,
149
156
  get: function () {
150
- return _utils2.skipFiltering;
157
+ return _utils3.skipFiltering;
151
158
  }
152
159
  });
153
160
  Object.defineProperty(exports, "skipSorting", {
154
161
  enumerable: true,
155
162
  get: function () {
156
- return _utils2.skipSorting;
163
+ return _utils3.skipSorting;
157
164
  }
158
165
  });
159
166
  Object.defineProperty(exports, "sortRowTree", {
@@ -331,11 +338,12 @@ var _useGridInfiniteLoadingIntersection = require("../hooks/features/serverSideL
331
338
  var _useGridDataSourcePro = require("../hooks/features/dataSource/useGridDataSourcePro");
332
339
  var _useGridDataSourceBasePro = require("../hooks/features/dataSource/useGridDataSourceBasePro");
333
340
  var _gridDataSourceSelector = require("../hooks/features/dataSource/gridDataSourceSelector");
341
+ var _utils = require("../hooks/features/dataSource/utils");
334
342
  var _createRowTree = require("../utils/tree/createRowTree");
335
343
  var _updateRowTree = require("../utils/tree/updateRowTree");
336
344
  var _sortRowTree = require("../utils/tree/sortRowTree");
337
- var _utils = require("../utils/tree/utils");
338
- var _utils2 = require("../hooks/features/serverSideTreeData/utils");
345
+ var _utils2 = require("../utils/tree/utils");
346
+ var _utils3 = require("../hooks/features/serverSideTreeData/utils");
339
347
  var _propValidation = require("./propValidation");
340
348
  Object.keys(_propValidation).forEach(function (key) {
341
349
  if (key === "default" || key === "__esModule") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "8.14.1",
3
+ "version": "8.16.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Pro plan edition of the MUI X Data Grid components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -37,9 +37,9 @@
37
37
  "@mui/utils": "^7.3.3",
38
38
  "clsx": "^2.1.1",
39
39
  "prop-types": "^15.8.1",
40
- "@mui/x-data-grid": "8.14.1",
41
- "@mui/x-license": "8.14.1",
42
- "@mui/x-internals": "8.14.0"
40
+ "@mui/x-data-grid": "8.16.0",
41
+ "@mui/x-license": "8.16.0",
42
+ "@mui/x-internals": "8.16.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",
@@ -2,6 +2,7 @@ import { GridFilterState, GridGroupNode, GridRowId, GridRowTreeConfig, GridRowsS
2
2
  import { GridTreeDepths } from '@mui/x-data-grid/internals';
3
3
  import { RowTreeBuilderGroupingCriterion } from "./models.js";
4
4
  import { DataGridProProps } from "../../models/dataGridProProps.js";
5
+ import type { GridStatePro } from "../../models/gridStatePro.js";
5
6
  export declare const getGroupRowIdFromPath: (path: RowTreeBuilderGroupingCriterion[]) => string;
6
7
  export declare const getNodePathInTree: ({
7
8
  id,
@@ -50,4 +51,4 @@ export declare const getVisibleRowsLookup: ({
50
51
  }: {
51
52
  tree: GridRowsState["tree"];
52
53
  filteredRowsLookup: GridFilterState["filteredRowsLookup"];
53
- }) => import("@mui/x-data-grid/hooks/features/filter/gridFilterState").GridVisibleRowsLookupState;
54
+ }) => GridStatePro["visibleRowsLookup"];
@@ -33,13 +33,20 @@ const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, maxDep
33
33
  if (maxDepth !== undefined && node.depth >= maxDepth) {
34
34
  return false;
35
35
  }
36
+
37
+ // If group existed in previous tree, preserve its expansion state
38
+ if (prevChildrenExpanded !== undefined) {
39
+ return prevChildrenExpanded;
40
+ }
41
+
42
+ // For new groups, apply default expansion configuration
36
43
  let childrenExpanded;
37
44
  if (node.id === _xDataGrid.GRID_ROOT_GROUP_ID) {
38
45
  childrenExpanded = true;
39
46
  } else if (isGroupExpandedByDefault) {
40
47
  childrenExpanded = isGroupExpandedByDefault(node);
41
48
  } else {
42
- childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth || (prevChildrenExpanded ?? false);
49
+ childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth;
43
50
  }
44
51
  return childrenExpanded;
45
52
  };