@mui/x-data-grid 7.24.1 → 7.26.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.
Files changed (188) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/DataGrid/DataGrid.js +1 -7
  3. package/DataGrid/useDataGridComponent.js +2 -2
  4. package/components/GridRow.d.ts +0 -1
  5. package/components/GridRow.js +32 -20
  6. package/components/GridScrollArea.d.ts +5 -2
  7. package/components/GridScrollArea.js +32 -25
  8. package/components/GridSkeletonLoadingOverlay.js +2 -1
  9. package/components/cell/GridCell.d.ts +9 -6
  10. package/components/cell/GridCell.js +29 -52
  11. package/components/containers/GridRoot.js +11 -9
  12. package/components/containers/GridRootStyles.js +138 -40
  13. package/components/toolbar/GridToolbarColumnsButton.js +5 -4
  14. package/components/toolbar/GridToolbarDensitySelector.js +2 -2
  15. package/components/toolbar/GridToolbarExportContainer.js +2 -2
  16. package/components/toolbar/GridToolbarFilterButton.js +4 -3
  17. package/components/virtualization/GridMainContainer.d.ts +10 -0
  18. package/components/virtualization/GridMainContainer.js +10 -2
  19. package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
  20. package/components/virtualization/GridVirtualScrollbar.js +5 -5
  21. package/components/virtualization/GridVirtualScroller.js +36 -16
  22. package/components/virtualization/GridVirtualScrollerContent.js +11 -2
  23. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
  24. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
  25. package/hooks/core/useGridStateInitialization.js +3 -2
  26. package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
  27. package/hooks/features/columnResize/useGridColumnResize.js +2 -1
  28. package/hooks/features/columns/gridColumnsSelector.d.ts +0 -5
  29. package/hooks/features/columns/gridColumnsSelector.js +0 -12
  30. package/hooks/features/columns/useGridColumns.js +7 -3
  31. package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +16 -0
  32. package/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
  33. package/hooks/features/dimensions/index.d.ts +1 -1
  34. package/hooks/features/dimensions/index.js +1 -2
  35. package/hooks/features/dimensions/useGridDimensions.js +102 -77
  36. package/hooks/features/editing/gridEditingSelectors.d.ts +10 -0
  37. package/hooks/features/editing/gridEditingSelectors.js +12 -1
  38. package/hooks/features/editing/index.d.ts +1 -1
  39. package/hooks/features/editing/index.js +1 -1
  40. package/hooks/features/editing/useGridCellEditing.js +3 -3
  41. package/hooks/features/editing/useGridRowEditing.js +8 -9
  42. package/hooks/features/filter/gridFilterState.d.ts +5 -0
  43. package/hooks/features/filter/gridFilterState.js +5 -0
  44. package/hooks/features/filter/useGridFilter.js +6 -13
  45. package/hooks/features/focus/useGridFocus.js +3 -2
  46. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
  47. package/hooks/features/keyboardNavigation/utils.d.ts +1 -2
  48. package/hooks/features/keyboardNavigation/utils.js +0 -5
  49. package/hooks/features/listView/useGridListView.js +2 -1
  50. package/hooks/features/pagination/useGridPagination.js +1 -1
  51. package/hooks/features/rowSelection/useGridRowSelection.js +4 -4
  52. package/hooks/features/rowSelection/utils.js +1 -1
  53. package/hooks/features/rows/gridRowsMetaState.d.ts +8 -0
  54. package/hooks/features/rows/gridRowsUtils.d.ts +0 -4
  55. package/hooks/features/rows/gridRowsUtils.js +0 -16
  56. package/hooks/features/rows/useGridParamsApi.d.ts +1 -1
  57. package/hooks/features/rows/useGridParamsApi.js +33 -14
  58. package/hooks/features/rows/useGridRowSpanning.js +94 -91
  59. package/hooks/features/rows/useGridRows.js +7 -8
  60. package/hooks/features/rows/useGridRowsMeta.js +36 -19
  61. package/hooks/features/sorting/gridSortingSelector.js +10 -9
  62. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  63. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +15 -1
  64. package/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
  65. package/hooks/utils/useGridSelector.d.ts +8 -1
  66. package/hooks/utils/useGridSelector.js +42 -8
  67. package/hooks/utils/useIsSSR.d.ts +1 -0
  68. package/hooks/utils/useIsSSR.js +5 -0
  69. package/index.js +1 -1
  70. package/internals/index.d.ts +2 -1
  71. package/internals/index.js +2 -1
  72. package/models/api/gridApiCommon.d.ts +2 -2
  73. package/models/api/gridParamsApi.d.ts +29 -2
  74. package/models/api/gridStateApi.d.ts +1 -0
  75. package/models/api/index.d.ts +1 -1
  76. package/models/api/index.js +0 -1
  77. package/models/events/gridEventLookup.d.ts +6 -0
  78. package/modern/DataGrid/DataGrid.js +1 -7
  79. package/modern/DataGrid/useDataGridComponent.js +2 -2
  80. package/modern/components/GridRow.js +32 -20
  81. package/modern/components/GridScrollArea.js +32 -25
  82. package/modern/components/GridSkeletonLoadingOverlay.js +2 -1
  83. package/modern/components/cell/GridCell.js +29 -52
  84. package/modern/components/containers/GridRoot.js +11 -9
  85. package/modern/components/containers/GridRootStyles.js +138 -40
  86. package/modern/components/toolbar/GridToolbarColumnsButton.js +5 -4
  87. package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
  88. package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
  89. package/modern/components/toolbar/GridToolbarFilterButton.js +4 -3
  90. package/modern/components/virtualization/GridMainContainer.js +10 -2
  91. package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
  92. package/modern/components/virtualization/GridVirtualScroller.js +36 -16
  93. package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
  94. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
  95. package/modern/hooks/core/useGridStateInitialization.js +3 -2
  96. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
  97. package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
  98. package/modern/hooks/features/columns/gridColumnsSelector.js +0 -12
  99. package/modern/hooks/features/columns/useGridColumns.js +7 -3
  100. package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
  101. package/modern/hooks/features/dimensions/index.js +1 -2
  102. package/modern/hooks/features/dimensions/useGridDimensions.js +102 -77
  103. package/modern/hooks/features/editing/gridEditingSelectors.js +12 -1
  104. package/modern/hooks/features/editing/index.js +1 -1
  105. package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
  106. package/modern/hooks/features/editing/useGridRowEditing.js +8 -9
  107. package/modern/hooks/features/filter/gridFilterState.js +5 -0
  108. package/modern/hooks/features/filter/useGridFilter.js +6 -13
  109. package/modern/hooks/features/focus/useGridFocus.js +3 -2
  110. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
  111. package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
  112. package/modern/hooks/features/listView/useGridListView.js +2 -1
  113. package/modern/hooks/features/pagination/useGridPagination.js +1 -1
  114. package/modern/hooks/features/rowSelection/useGridRowSelection.js +4 -4
  115. package/modern/hooks/features/rowSelection/utils.js +1 -1
  116. package/modern/hooks/features/rows/gridRowsUtils.js +0 -16
  117. package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
  118. package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
  119. package/modern/hooks/features/rows/useGridRows.js +7 -8
  120. package/modern/hooks/features/rows/useGridRowsMeta.js +36 -19
  121. package/modern/hooks/features/sorting/gridSortingSelector.js +10 -9
  122. package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  123. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
  124. package/modern/hooks/utils/useGridSelector.js +42 -8
  125. package/modern/hooks/utils/useIsSSR.js +5 -0
  126. package/modern/index.js +1 -1
  127. package/modern/internals/index.js +2 -1
  128. package/modern/models/api/index.js +0 -1
  129. package/modern/utils/roundToDecimalPlaces.js +3 -0
  130. package/modern/utils/utils.js +6 -1
  131. package/node/DataGrid/DataGrid.js +1 -7
  132. package/node/DataGrid/useDataGridComponent.js +2 -2
  133. package/node/components/GridRow.js +28 -17
  134. package/node/components/GridScrollArea.js +31 -24
  135. package/node/components/GridSkeletonLoadingOverlay.js +2 -1
  136. package/node/components/cell/GridCell.js +27 -50
  137. package/node/components/containers/GridRoot.js +10 -8
  138. package/node/components/containers/GridRootStyles.js +138 -40
  139. package/node/components/toolbar/GridToolbarColumnsButton.js +5 -4
  140. package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
  141. package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
  142. package/node/components/toolbar/GridToolbarFilterButton.js +4 -3
  143. package/node/components/virtualization/GridMainContainer.js +10 -2
  144. package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
  145. package/node/components/virtualization/GridVirtualScroller.js +36 -16
  146. package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
  147. package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
  148. package/node/hooks/core/useGridStateInitialization.js +3 -2
  149. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
  150. package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
  151. package/node/hooks/features/columns/gridColumnsSelector.js +1 -13
  152. package/node/hooks/features/columns/useGridColumns.js +7 -3
  153. package/node/hooks/features/dimensions/gridDimensionsSelectors.js +38 -2
  154. package/node/hooks/features/dimensions/index.js +13 -11
  155. package/node/hooks/features/dimensions/useGridDimensions.js +99 -74
  156. package/node/hooks/features/editing/gridEditingSelectors.js +12 -2
  157. package/node/hooks/features/editing/index.js +7 -11
  158. package/node/hooks/features/editing/useGridCellEditing.js +2 -2
  159. package/node/hooks/features/editing/useGridRowEditing.js +6 -7
  160. package/node/hooks/features/filter/gridFilterState.js +6 -1
  161. package/node/hooks/features/filter/useGridFilter.js +5 -12
  162. package/node/hooks/features/focus/useGridFocus.js +3 -2
  163. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
  164. package/node/hooks/features/keyboardNavigation/utils.js +0 -6
  165. package/node/hooks/features/listView/useGridListView.js +2 -1
  166. package/node/hooks/features/pagination/useGridPagination.js +1 -1
  167. package/node/hooks/features/rowSelection/useGridRowSelection.js +3 -3
  168. package/node/hooks/features/rowSelection/utils.js +1 -1
  169. package/node/hooks/features/rows/gridRowsUtils.js +0 -17
  170. package/node/hooks/features/rows/useGridParamsApi.js +33 -14
  171. package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
  172. package/node/hooks/features/rows/useGridRows.js +7 -8
  173. package/node/hooks/features/rows/useGridRowsMeta.js +36 -19
  174. package/node/hooks/features/sorting/gridSortingSelector.js +10 -9
  175. package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  176. package/node/hooks/features/virtualization/useGridVirtualScroller.js +73 -71
  177. package/node/hooks/utils/useGridSelector.js +42 -8
  178. package/node/hooks/utils/useIsSSR.js +12 -0
  179. package/node/index.js +1 -1
  180. package/node/internals/index.js +20 -7
  181. package/node/models/api/index.js +0 -11
  182. package/node/utils/roundToDecimalPlaces.js +9 -0
  183. package/node/utils/utils.js +8 -1
  184. package/package.json +3 -2
  185. package/utils/roundToDecimalPlaces.d.ts +1 -0
  186. package/utils/roundToDecimalPlaces.js +3 -0
  187. package/utils/utils.d.ts +1 -0
  188. package/utils/utils.js +6 -1
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
3
4
  import { warnOnce } from '@mui/x-internals/warning';
4
5
  import { gridDimensionsSelector } from "../dimensions/index.js";
5
6
  import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
@@ -37,7 +38,7 @@ export function useGridListView(apiRef, props) {
37
38
  /*
38
39
  * EFFECTS
39
40
  */
40
- React.useEffect(() => {
41
+ useEnhancedEffect(() => {
41
42
  const listColumn = props.unstable_listColumn;
42
43
  if (listColumn) {
43
44
  apiRef.current.setState(state => {
@@ -6,7 +6,7 @@ import { useGridPaginationMeta } from "./useGridPaginationMeta.js";
6
6
  export const paginationStateInitializer = (state, props) => {
7
7
  const paginationModel = _extends({}, getDefaultGridPaginationModel(props.autoPageSize), props.paginationModel ?? props.initialState?.pagination?.paginationModel);
8
8
  throwIfPageSizeExceedsTheLimit(paginationModel.pageSize, props.signature);
9
- const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
9
+ const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount ?? (props.paginationMode === 'client' ? state.rows?.totalRowCount : undefined);
10
10
  const meta = props.paginationMeta ?? props.initialState?.pagination?.meta ?? {};
11
11
  return _extends({}, state, {
12
12
  pagination: _extends({}, state.pagination, {
@@ -12,7 +12,7 @@ import { gridExpandedSortedRowIdsSelector, gridFilteredRowsLookupSelector } from
12
12
  import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from "../../../colDef/index.js";
13
13
  import { GridCellModes } from "../../../models/gridEditRowModel.js";
14
14
  import { isKeyboardEvent, isNavigationKey } from "../../../utils/keyboardUtils.js";
15
- import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
15
+ import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
16
16
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../internals/constants.js";
17
17
  import { gridClasses } from "../../../constants/gridClasses.js";
18
18
  import { isEventTargetInPortal } from "../../../utils/domUtils.js";
@@ -64,7 +64,6 @@ export const useGridRowSelection = (apiRef, props) => {
64
64
  isRowSelectable: propIsRowSelectable
65
65
  } = props;
66
66
  const canHaveMultipleSelection = isMultipleRowSelectionEnabled(props);
67
- const visibleRows = useGridVisibleRows(apiRef, props);
68
67
  const tree = useGridSelector(apiRef, gridRowTreeSelector);
69
68
  const isNestedData = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector) > 1;
70
69
  const expandMouseRowRangeSelection = React.useCallback(id => {
@@ -259,7 +258,7 @@ export const useGridRowSelection = (apiRef, props) => {
259
258
  if (props.filterMode === 'server') {
260
259
  return !rowsLookup[id];
261
260
  }
262
- return filteredRowsLookup[id] !== true;
261
+ return !rowsLookup[id] || filteredRowsLookup[id] === false;
263
262
  };
264
263
  let hasChanged = false;
265
264
  currentSelection.forEach(id => {
@@ -412,6 +411,7 @@ export const useGridRowSelection = (apiRef, props) => {
412
411
  end = previousRowIndex;
413
412
  }
414
413
  }
414
+ const visibleRows = getVisibleRows(apiRef);
415
415
  const rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(row => row.id);
416
416
  apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);
417
417
  return;
@@ -426,7 +426,7 @@ export const useGridRowSelection = (apiRef, props) => {
426
426
  event.preventDefault();
427
427
  selectRows(apiRef.current.getAllRowIds(), true);
428
428
  }
429
- }, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
429
+ }, [apiRef, handleSingleRowSelection, selectRows, canHaveMultipleSelection]);
430
430
  useGridApiEventHandler(apiRef, 'sortedRowsSet', runIfRowSelectionIsEnabled(() => removeOutdatedSelection(true)));
431
431
  useGridApiEventHandler(apiRef, 'filteredRowsSet', runIfRowSelectionIsEnabled(removeOutdatedSelection));
432
432
  useGridApiEventHandler(apiRef, 'rowClick', runIfRowSelectionIsEnabled(handleRowClick));
@@ -92,7 +92,7 @@ const getFilteredRowNodeSiblings = (tree, filteredRows, id) => {
92
92
  return [];
93
93
  }
94
94
  const parentNode = tree[parent];
95
- return parentNode.children.filter(childId => childId !== id && filteredRows[childId]);
95
+ return parentNode.children.filter(childId => childId !== id && filteredRows[childId] !== false);
96
96
  };
97
97
  export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendants, autoSelectParents, addRow) => {
98
98
  const filteredRows = gridFilteredRowsLookupSelector(apiRef);
@@ -10,4 +10,12 @@ export interface GridRowsMetaState {
10
10
  * The grid rows positions.
11
11
  */
12
12
  positions: number[];
13
+ /**
14
+ * The total height of the pinned top rows.
15
+ */
16
+ pinnedTopRowsTotalHeight: number;
17
+ /**
18
+ * The total height of the pinned bottom rows.
19
+ */
20
+ pinnedBottomRowsTotalHeight: number;
13
21
  }
@@ -33,10 +33,6 @@ export declare const updateCacheWithNewRows: ({ previousCache, getRowId, updates
33
33
  updates: GridRowModelUpdate[];
34
34
  groupKeys?: string[];
35
35
  }) => GridRowsInternalCache;
36
- export declare function calculatePinnedRowsHeight(apiRef: RefObject<GridApiCommunity>): {
37
- top: number;
38
- bottom: number;
39
- };
40
36
  export declare const minimalContentHeight = "var(--DataGrid-overlayHeight, calc(var(--height) * 2))";
41
37
  export declare function computeRowsUpdates(apiRef: RefObject<GridApiCommunity>, updates: GridRowModelUpdate[], getRowId: DataGridProcessedProps['getRowId']): GridRowModelUpdate[];
42
38
  export declare const getValidRowHeight: (rowHeightProp: any, defaultRowHeight: number, warningMessage: string) => number;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { gridPinnedRowsSelector } from "./gridRowsSelector.js";
3
2
  export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
4
3
  export const GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
5
4
  export const buildRootGroup = () => ({
@@ -269,21 +268,6 @@ export const updateCacheWithNewRows = ({
269
268
  rowCountPropBeforePartialUpdates: previousCache.rowCountPropBeforePartialUpdates
270
269
  };
271
270
  };
272
- export function calculatePinnedRowsHeight(apiRef) {
273
- const pinnedRows = gridPinnedRowsSelector(apiRef);
274
- const topPinnedRowsHeight = pinnedRows?.top?.reduce((acc, value) => {
275
- acc += apiRef.current.unstable_getRowHeight(value.id);
276
- return acc;
277
- }, 0) || 0;
278
- const bottomPinnedRowsHeight = pinnedRows?.bottom?.reduce((acc, value) => {
279
- acc += apiRef.current.unstable_getRowHeight(value.id);
280
- return acc;
281
- }, 0) || 0;
282
- return {
283
- top: topPinnedRowsHeight,
284
- bottom: bottomPinnedRowsHeight
285
- };
286
- }
287
271
  export const minimalContentHeight = 'var(--DataGrid-overlayHeight, calc(var(--height) * 2))';
288
272
  export function computeRowsUpdates(apiRef, updates, getRowId) {
289
273
  const nonPinnedRowsUpdates = [];
@@ -11,4 +11,4 @@ export declare class MissingRowIdError extends Error {
11
11
  * TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
12
12
  * TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
13
13
  */
14
- export declare function useGridParamsApi(apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_listView'>): void;
14
+ export declare function useGridParamsApi(apiRef: RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps): void;
@@ -30,37 +30,52 @@ export function useGridParamsApi(apiRef, props) {
30
30
  };
31
31
  return params;
32
32
  }, [apiRef]);
33
- const getCellParams = React.useCallback((id, field) => {
34
- const colDef = props.unstable_listView ? gridListColumnSelector(apiRef.current.state) : apiRef.current.getColumn(field);
35
- const row = apiRef.current.getRow(id);
36
- const rowNode = apiRef.current.getRowNode(id);
37
- if (!row || !rowNode) {
38
- throw new MissingRowIdError(`No row with id #${id} found`);
39
- }
33
+ const getCellParamsForRow = React.useCallback((id, field, row, {
34
+ cellMode,
35
+ colDef,
36
+ hasFocus,
37
+ rowNode,
38
+ tabIndex
39
+ }) => {
40
40
  const rawValue = row[field];
41
41
  const value = colDef?.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
42
- const cellFocus = gridFocusCellSelector(apiRef);
43
- const cellTabIndex = gridTabIndexCellSelector(apiRef);
44
42
  const params = {
45
43
  id,
46
44
  field,
47
45
  row,
48
46
  rowNode,
49
47
  colDef,
50
- cellMode: apiRef.current.getCellMode(id, field),
51
- hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
52
- tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1,
48
+ cellMode,
49
+ hasFocus,
50
+ tabIndex,
53
51
  value,
54
52
  formattedValue: value,
55
53
  isEditable: false,
56
- api: {}
54
+ api: null
57
55
  };
58
56
  if (colDef && colDef.valueFormatter) {
59
57
  params.formattedValue = colDef.valueFormatter(value, row, colDef, apiRef);
60
58
  }
61
59
  params.isEditable = colDef && apiRef.current.isCellEditable(params);
62
60
  return params;
63
- }, [apiRef, props.unstable_listView]);
61
+ }, [apiRef]);
62
+ const getCellParams = React.useCallback((id, field) => {
63
+ const row = apiRef.current.getRow(id);
64
+ const rowNode = apiRef.current.getRowNode(id);
65
+ if (!row || !rowNode) {
66
+ throw new MissingRowIdError(`No row with id #${id} found`);
67
+ }
68
+ const cellFocus = gridFocusCellSelector(apiRef);
69
+ const cellTabIndex = gridTabIndexCellSelector(apiRef);
70
+ const cellMode = apiRef.current.getCellMode(id, field);
71
+ return apiRef.current.getCellParamsForRow(id, field, row, {
72
+ colDef: props.unstable_listView && props.unstable_listColumn?.field === field ? gridListColumnSelector(apiRef.current.state) : apiRef.current.getColumn(field),
73
+ rowNode,
74
+ hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
75
+ tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1,
76
+ cellMode
77
+ });
78
+ }, [apiRef, props.unstable_listView, props.unstable_listColumn?.field]);
64
79
  const getCellValue = React.useCallback((id, field) => {
65
80
  const colDef = apiRef.current.getColumn(field);
66
81
  const row = apiRef.current.getRow(id);
@@ -119,5 +134,9 @@ export function useGridParamsApi(apiRef, props) {
119
134
  getColumnHeaderParams,
120
135
  getColumnHeaderElement
121
136
  };
137
+ const paramsPrivateApi = {
138
+ getCellParamsForRow
139
+ };
122
140
  useGridApiMethod(apiRef, paramsApi, 'public');
141
+ useGridApiMethod(apiRef, paramsPrivateApi, 'private');
123
142
  }
@@ -3,12 +3,14 @@ import * as React from 'react';
3
3
  import useLazyRef from '@mui/utils/useLazyRef';
4
4
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../internals/constants.js";
5
5
  import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.js";
6
- import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
6
+ import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
7
7
  import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
8
- import { useGridSelector } from "../../utils/useGridSelector.js";
9
- import { gridRowTreeSelector } from "./gridRowsSelector.js";
10
- import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
8
+ import { getUnprocessedRange, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
11
9
  import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
10
+ import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
11
+ import { runIf } from "../../../utils/utils.js";
12
+ import { gridPageSizeSelector } from "../pagination/index.js";
13
+ import { gridDataRowIdsSelector } from "./gridRowsSelector.js";
12
14
  const EMPTY_STATE = {
13
15
  spannedCells: {},
14
16
  hiddenCells: {},
@@ -53,8 +55,8 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
53
55
  const backwardsHiddenCells = [];
54
56
  if (index === rangeToProcess.firstRowIndex) {
55
57
  let prevIndex = index - 1;
56
- const prevRowEntry = visibleRows[prevIndex];
57
- while (prevIndex >= range.firstRowIndex && getCellValue(prevRowEntry.model, colDef, apiRef) === cellValue) {
58
+ let prevRowEntry = visibleRows[prevIndex];
59
+ while (prevIndex >= range.firstRowIndex && prevRowEntry && getCellValue(prevRowEntry.model, colDef, apiRef) === cellValue) {
58
60
  const currentRow = visibleRows[prevIndex + 1];
59
61
  if (hiddenCells[currentRow.id]) {
60
62
  hiddenCells[currentRow.id][colDef.field] = true;
@@ -68,6 +70,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
68
70
  spannedRowId = prevRowEntry.id;
69
71
  spannedRowIndex = prevIndex;
70
72
  prevIndex -= 1;
73
+ prevRowEntry = visibleRows[prevIndex];
71
74
  }
72
75
  }
73
76
  backwardsHiddenCells.forEach(hiddenCellIndex => {
@@ -123,6 +126,24 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
123
126
  processedRange
124
127
  };
125
128
  };
129
+ const getInitialRangeToProcess = (props, apiRef) => {
130
+ const rowCount = gridDataRowIdsSelector(apiRef).length;
131
+ if (props.pagination) {
132
+ const pageSize = gridPageSizeSelector(apiRef);
133
+ let paginationLastRowIndex = DEFAULT_ROWS_TO_PROCESS;
134
+ if (pageSize > 0) {
135
+ paginationLastRowIndex = pageSize - 1;
136
+ }
137
+ return {
138
+ firstRowIndex: 0,
139
+ lastRowIndex: Math.min(paginationLastRowIndex, rowCount)
140
+ };
141
+ }
142
+ return {
143
+ firstRowIndex: 0,
144
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, rowCount)
145
+ };
146
+ };
126
147
 
127
148
  /**
128
149
  * @requires columnsStateInitializer (method) - should be initialized before
@@ -130,74 +151,52 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
130
151
  * @requires filterStateInitializer (method) - should be initialized before
131
152
  */
132
153
  export const rowSpanningStateInitializer = (state, props, apiRef) => {
133
- if (props.unstable_rowSpanning) {
134
- const rowIds = state.rows.dataRowIds || [];
135
- const orderedFields = state.columns.orderedFields || [];
136
- const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
137
- const columnsLookup = state.columns.lookup;
138
- const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
139
- if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
140
- return _extends({}, state, {
141
- rowSpanning: EMPTY_STATE
142
- });
143
- }
144
- const rangeToProcess = {
145
- firstRowIndex: 0,
146
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
147
- };
148
- const rows = rowIds.map(id => ({
149
- id,
150
- model: dataRowIdToModelLookup[id]
151
- }));
152
- const colDefs = orderedFields.map(field => columnsLookup[field]);
153
- const {
154
- spannedCells,
155
- hiddenCells,
156
- hiddenCellOriginMap
157
- } = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
154
+ if (!props.unstable_rowSpanning) {
158
155
  return _extends({}, state, {
159
- rowSpanning: {
160
- spannedCells,
161
- hiddenCells,
162
- hiddenCellOriginMap
163
- }
156
+ rowSpanning: EMPTY_STATE
157
+ });
158
+ }
159
+ const rowIds = state.rows.dataRowIds || [];
160
+ const orderedFields = state.columns.orderedFields || [];
161
+ const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
162
+ const columnsLookup = state.columns.lookup;
163
+ const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
164
+ if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
165
+ return _extends({}, state, {
166
+ rowSpanning: EMPTY_STATE
164
167
  });
165
168
  }
169
+ const rangeToProcess = getInitialRangeToProcess(props, apiRef);
170
+ const rows = rowIds.map(id => ({
171
+ id,
172
+ model: dataRowIdToModelLookup[id]
173
+ }));
174
+ const colDefs = orderedFields.map(field => columnsLookup[field]);
175
+ const {
176
+ spannedCells,
177
+ hiddenCells,
178
+ hiddenCellOriginMap
179
+ } = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
166
180
  return _extends({}, state, {
167
- rowSpanning: EMPTY_STATE
181
+ rowSpanning: {
182
+ spannedCells,
183
+ hiddenCells,
184
+ hiddenCellOriginMap
185
+ }
168
186
  });
169
187
  };
170
188
  export const useGridRowSpanning = (apiRef, props) => {
171
- const {
172
- range,
173
- rows: visibleRows
174
- } = useGridVisibleRows(apiRef, props);
175
- const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
176
- const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
177
- const tree = useGridSelector(apiRef, gridRowTreeSelector);
178
189
  const processedRange = useLazyRef(() => {
179
- return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
180
- firstRowIndex: 0,
181
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
182
- } : EMPTY_RANGE;
190
+ return apiRef.current.state.rowSpanning !== EMPTY_STATE ? getInitialRangeToProcess(props, apiRef) : EMPTY_RANGE;
183
191
  });
184
- const lastRange = React.useRef(EMPTY_RANGE);
185
- const updateRowSpanningState = React.useCallback(
186
- // A reset needs to occur when:
187
- // - The `unstable_rowSpanning` prop is updated (feature flag)
188
- // - The filtering is applied
189
- // - The sorting is applied
190
- // - The `paginationModel` is updated
191
- // - The rows are updated
192
- (resetState = true) => {
193
- if (!props.unstable_rowSpanning) {
194
- if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
195
- apiRef.current.setState(state => _extends({}, state, {
196
- rowSpanning: EMPTY_STATE
197
- }));
198
- }
199
- return;
200
- }
192
+ const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
193
+ const {
194
+ range,
195
+ rows: visibleRows
196
+ } = getVisibleRows(apiRef, {
197
+ pagination: props.pagination,
198
+ paginationMode: props.paginationMode
199
+ });
201
200
  if (range === null || !isRowContextInitialized(renderContext)) {
202
201
  return;
203
202
  }
@@ -211,6 +210,7 @@ export const useGridRowSpanning = (apiRef, props) => {
211
210
  if (rangeToProcess === null) {
212
211
  return;
213
212
  }
213
+ const colDefs = gridVisibleColumnDefinitionsSelector(apiRef);
214
214
  const {
215
215
  spannedCells,
216
216
  hiddenCells,
@@ -223,7 +223,8 @@ export const useGridRowSpanning = (apiRef, props) => {
223
223
  const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
224
224
  const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
225
225
  const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
226
- if (!shouldUpdateState) {
226
+ const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
227
+ if (!shouldUpdateState || hasNoSpannedCells) {
227
228
  return;
228
229
  }
229
230
  apiRef.current.setState(state => {
@@ -235,33 +236,35 @@ export const useGridRowSpanning = (apiRef, props) => {
235
236
  }
236
237
  });
237
238
  });
238
- }, [apiRef, props.unstable_rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
239
- const prevRenderContext = React.useRef(renderContext);
240
- const isFirstRender = React.useRef(true);
241
- const shouldResetState = React.useRef(false);
242
- const previousTree = React.useRef(tree);
243
- React.useEffect(() => {
244
- const firstRender = isFirstRender.current;
245
- if (isFirstRender.current) {
246
- isFirstRender.current = false;
247
- }
248
- if (tree !== previousTree.current) {
249
- previousTree.current = tree;
250
- updateRowSpanningState(true);
239
+ }, [apiRef, processedRange, props.pagination, props.paginationMode]);
240
+
241
+ // Reset events trigger a full re-computation of the row spanning state:
242
+ // - The `unstable_rowSpanning` prop is updated (feature flag)
243
+ // - The filtering is applied
244
+ // - The sorting is applied
245
+ // - The `paginationModel` is updated
246
+ // - The rows are updated
247
+ const resetRowSpanningState = React.useCallback(() => {
248
+ const renderContext = gridRenderContextSelector(apiRef);
249
+ if (!isRowContextInitialized(renderContext)) {
251
250
  return;
252
251
  }
253
- if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
254
- lastRange.current = range;
255
- shouldResetState.current = true;
256
- }
257
- if (!firstRender && prevRenderContext.current !== renderContext) {
258
- if (isRowRangeUpdated(prevRenderContext.current, renderContext)) {
259
- updateRowSpanningState(shouldResetState.current);
260
- shouldResetState.current = false;
252
+ updateRowSpanningState(renderContext, true);
253
+ }, [apiRef, updateRowSpanningState]);
254
+ useGridApiEventHandler(apiRef, 'renderedRowsIntervalChange', runIf(props.unstable_rowSpanning, updateRowSpanningState));
255
+ useGridApiEventHandler(apiRef, 'sortedRowsSet', runIf(props.unstable_rowSpanning, resetRowSpanningState));
256
+ useGridApiEventHandler(apiRef, 'paginationModelChange', runIf(props.unstable_rowSpanning, resetRowSpanningState));
257
+ useGridApiEventHandler(apiRef, 'filteredRowsSet', runIf(props.unstable_rowSpanning, resetRowSpanningState));
258
+ useGridApiEventHandler(apiRef, 'columnsChange', runIf(props.unstable_rowSpanning, resetRowSpanningState));
259
+ React.useEffect(() => {
260
+ if (!props.unstable_rowSpanning) {
261
+ if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
262
+ apiRef.current.setState(state => _extends({}, state, {
263
+ rowSpanning: EMPTY_STATE
264
+ }));
261
265
  }
262
- prevRenderContext.current = renderContext;
263
- return;
266
+ } else if (apiRef.current.state.rowSpanning === EMPTY_STATE) {
267
+ resetRowSpanningState();
264
268
  }
265
- updateRowSpanningState();
266
- }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
269
+ }, [apiRef, resetRowSpanningState, props.unstable_rowSpanning]);
267
270
  };
@@ -39,7 +39,6 @@ export const useGridRows = (apiRef, props) => {
39
39
  }
40
40
  }
41
41
  const logger = useGridLogger(apiRef, 'useGridRows');
42
- const currentPage = getVisibleRows(apiRef);
43
42
  const lastUpdateMs = React.useRef(Date.now());
44
43
  const lastRowCount = React.useRef(props.rowCount);
45
44
  const timeout = useTimeout();
@@ -66,12 +65,6 @@ export const useGridRows = (apiRef, props) => {
66
65
  }
67
66
  return row.id;
68
67
  }, [getRowIdProp]);
69
- const lookup = React.useMemo(() => currentPage.rows.reduce((acc, {
70
- id
71
- }, index) => {
72
- acc[id] = index;
73
- return acc;
74
- }, {}), [currentPage.rows]);
75
68
  const throttledRowsChange = React.useCallback(({
76
69
  cache,
77
70
  throttle
@@ -170,7 +163,13 @@ export const useGridRows = (apiRef, props) => {
170
163
  }, [apiRef]);
171
164
  const getRowsCount = React.useCallback(() => gridRowCountSelector(apiRef), [apiRef]);
172
165
  const getAllRowIds = React.useCallback(() => gridDataRowIdsSelector(apiRef), [apiRef]);
173
- const getRowIndexRelativeToVisibleRows = React.useCallback(id => lookup[id], [lookup]);
166
+ const getRowIndexRelativeToVisibleRows = React.useCallback(id => {
167
+ const row = apiRef.current.getRow(id);
168
+ const {
169
+ rowToIndexMap
170
+ } = getVisibleRows(apiRef);
171
+ return rowToIndexMap.get(row);
172
+ }, [apiRef]);
174
173
  const setRowChildrenExpansion = React.useCallback((id, isExpanded) => {
175
174
  const currentNode = apiRef.current.getRowNode(id);
176
175
  if (!currentNode) {
@@ -1,18 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import useLazyRef from '@mui/utils/useLazyRef';
4
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
4
5
  import { ResizeObserver } from "../../../utils/ResizeObserver.js";
5
6
  import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
6
7
  import { eslintUseValue } from "../../../utils/utils.js";
7
8
  import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
8
9
  import { useGridSelector } from "../../utils/useGridSelector.js";
9
10
  import { gridDensityFactorSelector } from "../density/densitySelector.js";
10
- import { gridFilterModelSelector } from "../filter/gridFilterSelector.js";
11
11
  import { gridPaginationSelector } from "../pagination/gridPaginationSelector.js";
12
- import { gridSortModelSelector } from "../sorting/gridSortingSelector.js";
13
12
  import { useGridRegisterPipeApplier } from "../../core/pipeProcessing/index.js";
14
- import { gridPinnedRowsSelector } from "./gridRowsSelector.js";
15
- import { gridDimensionsSelector } from "../dimensions/gridDimensionsSelectors.js";
13
+ import { gridPinnedRowsSelector, gridRowCountSelector } from "./gridRowsSelector.js";
14
+ import { gridDimensionsSelector, gridRowHeightSelector } from "../dimensions/gridDimensionsSelectors.js";
16
15
  import { getValidRowHeight, getRowHeightWarning } from "./gridRowsUtils.js";
17
16
  /* eslint-disable no-underscore-dangle */
18
17
 
@@ -20,10 +19,18 @@ export const rowsMetaStateInitializer = (state, props, apiRef) => {
20
19
  apiRef.current.caches.rowsMeta = {
21
20
  heights: new Map()
22
21
  };
22
+ const baseRowHeight = gridRowHeightSelector(apiRef.current.state);
23
+ const dataRowCount = gridRowCountSelector(apiRef);
24
+ const pagination = gridPaginationSelector(apiRef.current.state);
25
+ const rowCount = Math.min(pagination.enabled ? pagination.paginationModel.pageSize : dataRowCount, dataRowCount);
23
26
  return _extends({}, state, {
24
27
  rowsMeta: {
25
- currentPageTotalHeight: 0,
26
- positions: []
28
+ currentPageTotalHeight: rowCount * baseRowHeight,
29
+ positions: Array.from({
30
+ length: rowCount
31
+ }, (_, i) => i * baseRowHeight),
32
+ pinnedTopRowsTotalHeight: 0,
33
+ pinnedBottomRowsTotalHeight: 0
27
34
  }
28
35
  });
29
36
  };
@@ -43,12 +50,9 @@ export const useGridRowsMeta = (apiRef, props) => {
43
50
  const hasRowWithAutoHeight = React.useRef(false);
44
51
  const isHeightMetaValid = React.useRef(false);
45
52
  const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
46
- const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
47
- const paginationState = useGridSelector(apiRef, gridPaginationSelector);
48
- const sortModel = useGridSelector(apiRef, gridSortModelSelector);
49
53
  const currentPage = useGridVisibleRows(apiRef, props);
50
54
  const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
51
- const rowHeight = useGridSelector(apiRef, () => gridDimensionsSelector(apiRef.current.state).rowHeight);
55
+ const rowHeight = useGridSelector(apiRef, gridRowHeightSelector);
52
56
  const getRowHeightEntry = rowId => {
53
57
  let entry = heightCache.get(rowId);
54
58
  if (entry === undefined) {
@@ -110,11 +114,17 @@ export const useGridRowsMeta = (apiRef, props) => {
110
114
  }
111
115
  apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row);
112
116
  return entry;
113
- }, [apiRef, currentPage.rows.length, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
117
+ }, [apiRef, currentPage.rows, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
114
118
  const hydrateRowsMeta = React.useCallback(() => {
115
119
  hasRowWithAutoHeight.current = false;
116
- pinnedRows.top.forEach(processHeightEntry);
117
- pinnedRows.bottom.forEach(processHeightEntry);
120
+ const pinnedTopRowsTotalHeight = pinnedRows.top.reduce((acc, row) => {
121
+ const entry = processHeightEntry(row);
122
+ return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
123
+ }, 0);
124
+ const pinnedBottomRowsTotalHeight = pinnedRows.bottom.reduce((acc, row) => {
125
+ const entry = processHeightEntry(row);
126
+ return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
127
+ }, 0);
118
128
  const positions = [];
119
129
  const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
120
130
  positions.push(acc);
@@ -126,14 +136,21 @@ export const useGridRowsMeta = (apiRef, props) => {
126
136
  // No row has height=auto, so all rows are already measured
127
137
  lastMeasuredRowIndex.current = Infinity;
128
138
  }
139
+ const didHeightsChange = pinnedTopRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedTopRowsTotalHeight || pinnedBottomRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedBottomRowsTotalHeight || currentPageTotalHeight !== apiRef.current.state.rowsMeta.currentPageTotalHeight;
140
+ const rowsMeta = {
141
+ currentPageTotalHeight,
142
+ positions,
143
+ pinnedTopRowsTotalHeight,
144
+ pinnedBottomRowsTotalHeight
145
+ };
129
146
  apiRef.current.setState(state => {
130
147
  return _extends({}, state, {
131
- rowsMeta: {
132
- currentPageTotalHeight,
133
- positions
134
- }
148
+ rowsMeta
135
149
  });
136
150
  });
151
+ if (didHeightsChange) {
152
+ apiRef.current.updateDimensions();
153
+ }
137
154
  isHeightMetaValid.current = true;
138
155
  }, [apiRef, pinnedRows, currentPage.rows, processHeightEntry]);
139
156
  const getRowHeight = rowId => {
@@ -181,9 +198,9 @@ export const useGridRowsMeta = (apiRef, props) => {
181
198
 
182
199
  // The effect is used to build the rows meta data - currentPageTotalHeight and positions.
183
200
  // Because of variable row height this is needed for the virtualization
184
- React.useEffect(() => {
201
+ useEnhancedEffect(() => {
185
202
  hydrateRowsMeta();
186
- }, [filterModel, paginationState, sortModel, hydrateRowsMeta]);
203
+ }, [hydrateRowsMeta]);
187
204
  const rowsMetaApi = {
188
205
  unstable_getRowHeight: getRowHeight,
189
206
  unstable_setLastMeasuredRowIndex: setLastMeasuredRowIndex,
@@ -24,15 +24,16 @@ export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRow
24
24
  id,
25
25
  model
26
26
  });
27
- }
28
- const rowNode = rowTree[id];
29
- if (rowNode && isAutogeneratedRowNode(rowNode)) {
30
- acc.push({
31
- id,
32
- model: {
33
- [GRID_ID_AUTOGENERATED]: id
34
- }
35
- });
27
+ } else {
28
+ const rowNode = rowTree[id];
29
+ if (rowNode && isAutogeneratedRowNode(rowNode)) {
30
+ acc.push({
31
+ id,
32
+ model: {
33
+ [GRID_ID_AUTOGENERATED]: id
34
+ }
35
+ });
36
+ }
36
37
  }
37
38
  return acc;
38
39
  }, []));