@mui/x-data-grid 7.28.1 → 7.28.2

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
@@ -3,6 +3,47 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.28.2
7
+
8
+ _Mar 28, 2025_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🐞 Bugfixes
13
+
14
+ Team members who have contributed to this release:
15
+ @flaviendelangle, @LukasTy, @arminmeh.
16
+
17
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@7.28.2`
22
+
23
+ - [DataGrid] Fix error caused by trying to render rows that are not in the state anymore (#17117) @arminmeh
24
+
25
+ #### `@mui/x-data-grid-pro@7.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
26
+
27
+ Same changes as in `@mui/x-data-grid@7.28.2`.
28
+
29
+ #### `@mui/x-data-grid-premium@7.28.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
30
+
31
+ Same changes as in `@mui/x-data-grid-pro@7.28.2`.
32
+
33
+ ### Date and Time Pickers
34
+
35
+ #### `@mui/x-date-pickers@7.28.2`
36
+
37
+ - [fields] Improve the check for year in `doesSectionFormatHaveLeadingZeros` (#17112) @flaviendelangle
38
+
39
+ #### `@mui/x-date-pickers-pro@7.28.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
40
+
41
+ Same changes as in `@mui/x-date-pickers@7.28.2`.
42
+
43
+ ### Core
44
+
45
+ - [code-infra] Remove `test_regressions` step from React 18 pipeline (#17109) @LukasTy
46
+
6
47
  ## 7.28.1
7
48
 
8
49
  _Mar 21, 2025_
@@ -192,7 +192,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
192
192
  return rowStyle;
193
193
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
194
194
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
195
- const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
195
+ const ariaAttributes = getRowAriaAttributes(rowNode, index);
196
196
  if (typeof rootProps.getRowClassName === 'function') {
197
197
  const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
198
198
  const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
@@ -202,11 +202,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
202
202
  });
203
203
  rowClassNames.push(rootProps.getRowClassName(rowParams));
204
204
  }
205
-
206
- /* Start of rendering */
207
- if (!rowNode) {
208
- return null;
209
- }
210
205
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
211
206
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
212
207
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -215,7 +210,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
215
210
  const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
216
211
  const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
217
212
  const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
218
- if (rowNode?.type === 'skeletonRow') {
213
+ if (rowNode.type === 'skeletonRow') {
219
214
  return /*#__PURE__*/_jsx(slots.skeletonCell, {
220
215
  type: column.type,
221
216
  width: width,
@@ -44,8 +44,6 @@ export function useGridColumns(apiRef, props) {
44
44
  logger.debug('Updating columns state.');
45
45
  apiRef.current.setState(mergeColumnsState(columnsState));
46
46
  apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
47
- apiRef.current.updateRenderContext?.();
48
- apiRef.current.forceUpdate();
49
47
  }, [logger, apiRef]);
50
48
 
51
49
  /**
@@ -12,7 +12,7 @@ import { useGridRootProps } from "../../utils/useGridRootProps.js";
12
12
  import { useGridSelector } from "../../utils/useGridSelector.js";
13
13
  import { useRunOnce } from "../../utils/useRunOnce.js";
14
14
  import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../columns/gridColumnsSelector.js";
15
- import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
15
+ import { gridPinnedRowsSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
16
16
  import { useGridVisibleRows, getVisibleRows } from "../../utils/useGridVisibleRows.js";
17
17
  import { useGridApiOptionHandler } from "../../utils/index.js";
18
18
  import * as platform from "../../../utils/platform.js";
@@ -258,6 +258,7 @@ export const useGridVirtualScroller = () => {
258
258
  if (!params.rows && !currentPage.range) {
259
259
  return [];
260
260
  }
261
+ const rowTree = gridRowTreeSelector(apiRef);
261
262
  let baseRenderContext = renderContext;
262
263
  if (params.renderContext) {
263
264
  baseRenderContext = params.renderContext;
@@ -303,6 +304,16 @@ export const useGridVirtualScroller = () => {
303
304
  id,
304
305
  model
305
306
  } = rowModels[rowIndexInPage];
307
+
308
+ // In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
309
+ // contains stale data.
310
+ // In that case, skip any further row processing.
311
+ // See:
312
+ // - https://github.com/mui/mui-x/issues/16638
313
+ // - https://github.com/mui/mui-x/issues/17022
314
+ if (!rowTree[id]) {
315
+ return;
316
+ }
306
317
  const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
307
318
 
308
319
  // NOTE: This is an expensive feature, the colSpan code could be optimized.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.28.1
2
+ * @mui/x-data-grid v7.28.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -192,7 +192,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
192
192
  return rowStyle;
193
193
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
194
194
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
195
- const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
195
+ const ariaAttributes = getRowAriaAttributes(rowNode, index);
196
196
  if (typeof rootProps.getRowClassName === 'function') {
197
197
  const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
198
198
  const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
@@ -202,11 +202,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
202
202
  });
203
203
  rowClassNames.push(rootProps.getRowClassName(rowParams));
204
204
  }
205
-
206
- /* Start of rendering */
207
- if (!rowNode) {
208
- return null;
209
- }
210
205
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
211
206
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
212
207
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -215,7 +210,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
215
210
  const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
216
211
  const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
217
212
  const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
218
- if (rowNode?.type === 'skeletonRow') {
213
+ if (rowNode.type === 'skeletonRow') {
219
214
  return /*#__PURE__*/_jsx(slots.skeletonCell, {
220
215
  type: column.type,
221
216
  width: width,
@@ -44,8 +44,6 @@ export function useGridColumns(apiRef, props) {
44
44
  logger.debug('Updating columns state.');
45
45
  apiRef.current.setState(mergeColumnsState(columnsState));
46
46
  apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
47
- apiRef.current.updateRenderContext?.();
48
- apiRef.current.forceUpdate();
49
47
  }, [logger, apiRef]);
50
48
 
51
49
  /**
@@ -12,7 +12,7 @@ import { useGridRootProps } from "../../utils/useGridRootProps.js";
12
12
  import { useGridSelector } from "../../utils/useGridSelector.js";
13
13
  import { useRunOnce } from "../../utils/useRunOnce.js";
14
14
  import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../columns/gridColumnsSelector.js";
15
- import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
15
+ import { gridPinnedRowsSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
16
16
  import { useGridVisibleRows, getVisibleRows } from "../../utils/useGridVisibleRows.js";
17
17
  import { useGridApiOptionHandler } from "../../utils/index.js";
18
18
  import * as platform from "../../../utils/platform.js";
@@ -258,6 +258,7 @@ export const useGridVirtualScroller = () => {
258
258
  if (!params.rows && !currentPage.range) {
259
259
  return [];
260
260
  }
261
+ const rowTree = gridRowTreeSelector(apiRef);
261
262
  let baseRenderContext = renderContext;
262
263
  if (params.renderContext) {
263
264
  baseRenderContext = params.renderContext;
@@ -303,6 +304,16 @@ export const useGridVirtualScroller = () => {
303
304
  id,
304
305
  model
305
306
  } = rowModels[rowIndexInPage];
307
+
308
+ // In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
309
+ // contains stale data.
310
+ // In that case, skip any further row processing.
311
+ // See:
312
+ // - https://github.com/mui/mui-x/issues/16638
313
+ // - https://github.com/mui/mui-x/issues/17022
314
+ if (!rowTree[id]) {
315
+ return;
316
+ }
306
317
  const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
307
318
 
308
319
  // NOTE: This is an expensive feature, the colSpan code could be optimized.
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.28.1
2
+ * @mui/x-data-grid v7.28.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -199,7 +199,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
199
199
  return rowStyle;
200
200
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
201
201
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
202
- const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
202
+ const ariaAttributes = getRowAriaAttributes(rowNode, index);
203
203
  if (typeof rootProps.getRowClassName === 'function') {
204
204
  const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
205
205
  const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
@@ -209,11 +209,6 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
209
209
  });
210
210
  rowClassNames.push(rootProps.getRowClassName(rowParams));
211
211
  }
212
-
213
- /* Start of rendering */
214
- if (!rowNode) {
215
- return null;
216
- }
217
212
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
218
213
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
219
214
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -222,7 +217,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
222
217
  const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
223
218
  const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
224
219
  const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
225
- if (rowNode?.type === 'skeletonRow') {
220
+ if (rowNode.type === 'skeletonRow') {
226
221
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
227
222
  type: column.type,
228
223
  width: width,
@@ -54,8 +54,6 @@ function useGridColumns(apiRef, props) {
54
54
  logger.debug('Updating columns state.');
55
55
  apiRef.current.setState(mergeColumnsState(columnsState));
56
56
  apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
57
- apiRef.current.updateRenderContext?.();
58
- apiRef.current.forceUpdate();
59
57
  }, [logger, apiRef]);
60
58
 
61
59
  /**
@@ -269,6 +269,7 @@ const useGridVirtualScroller = () => {
269
269
  if (!params.rows && !currentPage.range) {
270
270
  return [];
271
271
  }
272
+ const rowTree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
272
273
  let baseRenderContext = renderContext;
273
274
  if (params.renderContext) {
274
275
  baseRenderContext = params.renderContext;
@@ -314,6 +315,16 @@ const useGridVirtualScroller = () => {
314
315
  id,
315
316
  model
316
317
  } = rowModels[rowIndexInPage];
318
+
319
+ // In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
320
+ // contains stale data.
321
+ // In that case, skip any further row processing.
322
+ // See:
323
+ // - https://github.com/mui/mui-x/issues/16638
324
+ // - https://github.com/mui/mui-x/issues/17022
325
+ if (!rowTree[id]) {
326
+ return;
327
+ }
317
328
  const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
318
329
 
319
330
  // NOTE: This is an expensive feature, the colSpan code could be optimized.
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.28.1
2
+ * @mui/x-data-grid v7.28.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.28.1",
3
+ "version": "7.28.2",
4
4
  "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",