Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data Grid] Avoid <GridRoot /> double-render pass on mount in SPA mode #15648

Open
wants to merge 142 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 128 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
c0944e1
add useIsSSR hook to with useSyncExternalStore to avoid double-render…
lauri865 Nov 28, 2024
ad08bcd
remove unused import
lauri865 Nov 28, 2024
2ff2567
add missing dependency
lauri865 Nov 28, 2024
128234a
add missing types
lauri865 Nov 28, 2024
8da261b
fix failing test
lauri865 Nov 28, 2024
e680805
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Nov 28, 2024
eb491c6
lint
lauri865 Nov 28, 2024
8d2a78d
fix some tests
lauri865 Dec 4, 2024
c8580d9
fix flicker on mount
lauri865 Dec 4, 2024
c459ad6
don't hydrate widths unless there's a flex column
lauri865 Dec 4, 2024
01cbb00
fix tests
lauri865 Dec 4, 2024
d4707a1
lint
lauri865 Dec 4, 2024
5ca918f
fix: aggregation should trigger column update directly, and not lean …
lauri865 Dec 4, 2024
9cd2134
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Dec 4, 2024
4287d0a
Fix for grid aggregation out of order column hydration
lauri865 Dec 4, 2024
903554e
fix grid dimension calling updateRenderContext before dimensions have…
lauri865 Dec 4, 2024
91cd557
link
lauri865 Dec 4, 2024
20f87a0
remove debug
lauri865 Dec 4, 2024
a51aa8e
use selectors for pinnedrow heights to update dimensions
lauri865 Dec 4, 2024
6d01710
cleanup
lauri865 Dec 4, 2024
063c0b0
fix
lauri865 Dec 4, 2024
f87588c
fix
lauri865 Dec 4, 2024
95f3f08
fix
lauri865 Dec 4, 2024
8fdcb8c
fix
lauri865 Dec 4, 2024
d6ee4a2
fix
lauri865 Dec 4, 2024
2eab88c
test
lauri865 Dec 4, 2024
f709da6
fix
lauri865 Dec 4, 2024
7313c34
fix
lauri865 Dec 4, 2024
52c051d
test
lauri865 Dec 5, 2024
5cc425f
test
lauri865 Dec 5, 2024
0b1f757
test
lauri865 Dec 5, 2024
4514cd4
test
lauri865 Dec 5, 2024
b861e41
fix selector returning stale data
lauri865 Dec 5, 2024
b366708
test alternative rendercontext updates
lauri865 Dec 5, 2024
9176ec0
fix dimension->renderContext propagation
lauri865 Dec 5, 2024
f29dfbc
fix aggregation cache not being initialized properly
lauri865 Dec 5, 2024
6995ed7
fix filler border top showing on first row
lauri865 Dec 5, 2024
4b7f544
fix jumping autoheight
lauri865 Dec 5, 2024
1495b06
Merge remote-tracking branch 'upstream/master' into avoid-double-rend…
lauri865 Jan 26, 2025
d4eb696
lint: reorder package.json
lauri865 Jan 26, 2025
35cf5e3
remove `calculatePinnedRowsHeight`
lauri865 Jan 26, 2025
631c6b6
revert to throttle
lauri865 Jan 26, 2025
1397dbc
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 26, 2025
2ee5a28
fix test
lauri865 Jan 26, 2025
8bb087e
oops
lauri865 Jan 26, 2025
30c10ba
fix
lauri865 Jan 26, 2025
14c42f4
control update flow
lauri865 Jan 26, 2025
989811c
refactor
lauri865 Jan 26, 2025
0a91c02
fix renderedRowsIntervalChange
lauri865 Jan 26, 2025
c19f001
fix
lauri865 Jan 26, 2025
f88d9a2
fix
lauri865 Jan 26, 2025
0ecb2dd
test
lauri865 Jan 26, 2025
73d0ff7
properly initialize static dimensions
lauri865 Jan 26, 2025
6201f02
fix order
lauri865 Jan 26, 2025
c4190fb
fix
lauri865 Jan 26, 2025
9f5a709
cleanup
lauri865 Jan 26, 2025
051db9c
split ownership of renderContext updates between `useGridDimensions` …
lauri865 Jan 26, 2025
666bf4c
remove unnecessary event handler
lauri865 Jan 26, 2025
94a1caf
fix flaky test
lauri865 Jan 26, 2025
e6c32a9
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 27, 2025
b72df72
remove !
lauri865 Jan 27, 2025
5b8686d
deprecate forceupdate
lauri865 Jan 27, 2025
68e79df
typo
lauri865 Jan 27, 2025
663a5dd
lint
lauri865 Jan 27, 2025
7a93d2e
remove unused prop
lauri865 Jan 27, 2025
f9f250c
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 27, 2025
18e4361
refactor debounce logic
lauri865 Jan 27, 2025
4388740
perf: don't filter data if there are no filters
lauri865 Jan 27, 2025
4c3fda2
lint
lauri865 Jan 27, 2025
bed334e
lint
lauri865 Jan 27, 2025
281bd96
stable filter lookup base state
lauri865 Jan 27, 2025
9cfa9d9
simplify
lauri865 Jan 27, 2025
24b5ae0
remove repeated line
lauri865 Jan 27, 2025
a66231d
perf: check for autogenerated rows only if model doesn't exist
lauri865 Jan 27, 2025
fcd3c9c
lint `useGridDimensions`
lauri865 Jan 27, 2025
9c72ea7
Merge remote-tracking branch 'upstream/master' into avoid-double-rend…
lauri865 Jan 27, 2025
10bdcd8
use empty object for `useGridSelector` deps
lauri865 Jan 27, 2025
bf8bcf4
fix
lauri865 Jan 27, 2025
ac18ea5
fix row editing selector
lauri865 Jan 27, 2025
fc18204
lint
lauri865 Jan 27, 2025
0cfce51
ci
lauri865 Jan 27, 2025
4325795
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 28, 2025
8932863
perf: improve resize performance
lauri865 Jan 28, 2025
c2f90cb
perf: resize performance / use granular selectors for dimensions
lauri865 Jan 28, 2025
b600821
ci
lauri865 Jan 28, 2025
c78076c
reorg
lauri865 Jan 28, 2025
bc44121
fix
lauri865 Jan 28, 2025
e8b451c
fix
lauri865 Jan 28, 2025
5b0df33
fix styles re-evaluating on each render
lauri865 Jan 28, 2025
5e4eb36
watermark as const
lauri865 Jan 28, 2025
c42a435
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 28, 2025
f2b57b0
perf: +10-15 fps
lauri865 Jan 28, 2025
008bf87
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 28, 2025
cf2cd66
ci
lauri865 Jan 29, 2025
d8e7f0c
fix tests
lauri865 Jan 29, 2025
51eea10
fix
lauri865 Jan 29, 2025
abcd947
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 29, 2025
53b1e82
Merge remote-tracking branch 'upstream/master' into avoid-double-rend…
lauri865 Jan 29, 2025
560a436
ci
lauri865 Jan 29, 2025
c3f54b3
fix test
lauri865 Jan 29, 2025
1c5fc8c
lint
lauri865 Jan 29, 2025
bbcb8a3
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 29, 2025
3a57406
stable obj
lauri865 Jan 29, 2025
ffa1efc
reduce unnecessary calls to `hydrateRowsMeta`
lauri865 Jan 30, 2025
0fc0226
Merge remote-tracking branch 'upstream/master' into avoid-double-rend…
lauri865 Jan 30, 2025
ae6cc13
lint
lauri865 Jan 30, 2025
34f24b3
fix recipe
lauri865 Jan 30, 2025
56f75fa
lint
lauri865 Jan 30, 2025
2415b59
fix grid selector timing issue
lauri865 Jan 31, 2025
b63c07a
lint
lauri865 Jan 31, 2025
37cf769
lint
lauri865 Jan 31, 2025
b10a81f
readability
lauri865 Jan 31, 2025
45f70a1
add `rootMount` event
lauri865 Jan 31, 2025
d92c4d8
use `useSyncExternalStore` for `useGridSelector`
lauri865 Jan 31, 2025
43829e8
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 31, 2025
25998ec
fix
lauri865 Jan 31, 2025
e6399e2
fix
lauri865 Jan 31, 2025
d4b652b
make typescript happy
lauri865 Jan 31, 2025
9f95fee
alternative syncexternalstore implementationgetState
lauri865 Jan 31, 2025
32e4dc2
fix
lauri865 Jan 31, 2025
bae6d94
fix
lauri865 Jan 31, 2025
cddb1bf
fuck me
lauri865 Jan 31, 2025
74d77a9
update changelog
cherniavskii Jan 31, 2025
e8963eb
update diff
cherniavskii Jan 31, 2025
5d0109b
perf: `rowsHeightsChange` event to streamline dimensions/renderContex…
lauri865 Jan 31, 2025
12e0e74
lint
lauri865 Jan 31, 2025
ee91dbc
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 31, 2025
3449782
narrow filteredRowsLookup type
cherniavskii Jan 31, 2025
4c5fa74
Merge branch 'master' into avoid-double-render-pass-in-spas
lauri865 Jan 31, 2025
26be717
fix
lauri865 Feb 1, 2025
b4ab00c
fix
lauri865 Feb 1, 2025
eb577a3
fix detailpanel
lauri865 Feb 1, 2025
d628881
remove some newly introduced selectors
lauri865 Feb 1, 2025
9760a27
column render context override
lauri865 Feb 1, 2025
7005366
revert
lauri865 Feb 1, 2025
680d823
Merge branch 'master' into avoid-double-render-pass-in-spas
cherniavskii Feb 3, 2025
af40788
narrow visibleRowsLookup type
cherniavskii Feb 3, 2025
0b6bcda
update changelog
cherniavskii Feb 3, 2025
676da6b
useEventCallback
cherniavskii Feb 3, 2025
76fb889
Merge branch 'master' into avoid-double-render-pass-in-spas
cherniavskii Feb 3, 2025
f8ca726
Revert "useEventCallback"
cherniavskii Feb 4, 2025
e45e07a
Merge branch 'master' into avoid-double-render-pass-in-spas
cherniavskii Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/data/data-grid/events/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@
"params": "ElementSize",
"event": "MuiEvent<{}>"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "rootMount",
"description": "Fired when rootElementRef.current becomes available.",
"params": "HTMLElement",
"event": "MuiEvent<{}>"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "rowClick",
Expand Down Expand Up @@ -402,6 +409,13 @@
"params": "GridRowSelectionCheckboxParams",
"event": "MuiEvent<React.ChangeEvent<HTMLElement>>"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "rowsHeightsChange",
"description": "Fired when the rows total heights change. GridRowsMetaState object.",
"params": "GridRowsMetaState",
"event": "MuiEvent<{}>"
},
{
"projects": ["x-data-grid-pro", "x-data-grid-premium"],
"name": "rowsScrollEnd",
Expand Down
7 changes: 3 additions & 4 deletions docs/data/data-grid/filtering-recipes/FilteredRowCount.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the proposed change, but why doesn't the previous implementation work anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to this change:

if (!isRowPassing) {
filteredRowsLookup[id] = isRowPassing;
}

If we can skip filteredRowsLookup assigning values for both true and false, we can easily skip many O(n) operations (e.g. building filteredRowsLookup to begin with, but there was more cascading ones) if there are no filters present, as well have a smaller resulting object. Then we can just check for isObjectEmpty and skip the ops. There was only once instance internally that checked for true value and everything else checked for filteredRowsLookup[id] !== false.

Copy link
Contributor Author

@lauri865 lauri865 Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. editing cells in this demo should be a few frames faster now when you commit the changes (same for initial mount and row updates):
https://deploy-preview-15648--material-ui-x.netlify.app/x/react-data-grid/#pro-version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍🏻
I'll mention this change in the changelog, and perhaps revert it in a v7 cherry-pick PR to avoid breaking things.

Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ export default function FilteredRowCount() {

const getFilteredRowsCount = React.useCallback(
(filterModel) => {
const rowIds = apiRef.current?.getAllRowIds();
const filterState = apiRef.current?.getFilterState(filterModel);
if (!filterState) {
if (!rowIds || !filterState) {
return 0;
}

const { filteredRowsLookup } = filterState;
return Object.keys(filteredRowsLookup).filter(
(rowId) => filteredRowsLookup[rowId] === true,
).length;
return rowIds.filter((rowId) => filteredRowsLookup[rowId] !== false).length;
},
[apiRef],
);
Expand Down
7 changes: 3 additions & 4 deletions docs/data/data-grid/filtering-recipes/FilteredRowCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ export default function FilteredRowCount() {

const getFilteredRowsCount = React.useCallback(
(filterModel: GridFilterModel) => {
const rowIds = apiRef.current?.getAllRowIds();
const filterState = apiRef.current?.getFilterState(filterModel);
if (!filterState) {
if (!rowIds || !filterState) {
return 0;
}

const { filteredRowsLookup } = filterState;
return Object.keys(filteredRowsLookup).filter(
(rowId) => filteredRowsLookup[rowId] === true,
).length;
return rowIds.filter((rowId) => filteredRowsLookup[rowId] !== false).length;
},
[apiRef],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ Below are described the steps you need to make to migrate from v7 to v8.
+const output = useGridSelector(apiRef, selector, arguments, equals);
```

- The `filteredRowsLookup` object of the filter state does not contain `true` values anymore. If the row is filtered out, the value is `false`. Otherwise, the row id is not present in the object.
This change only impacts you if you relied on `filteredRowsLookup` to get ids of filtered rows. In this case,use `gridDataRowIdsSelector` selector to get row ids and check `filteredRowsLookup` for `false` values:

```diff
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
-const filteredRowIds = Object.keys(filteredRowsLookup).filter((rowId) => filteredRowsLookup[rowId] === true);
+const rowIds = gridDataRowIdsSelector(apiRef);
+const filteredRowIds = rowIds.filter((rowId) => filteredRowsLookup[rowId] !== false);
```

### Other exports

- `ariaV8` experimental flag is removed. It's now the default behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const configuration = {
},
};
const releaseInfo = getReleaseInfo();
const watermark = <Watermark packageName="x-data-grid-premium" releaseInfo={releaseInfo} />;

let dataGridPremiumPropValidators: PropValidator<DataGridPremiumProcessedProps>[];

Expand All @@ -47,6 +48,7 @@ const DataGridPremiumRaw = forwardRef(function DataGridPremium<R extends GridVal
if (process.env.NODE_ENV !== 'production') {
validateProps(props, dataGridPremiumPropValidators);
}

return (
<GridContextProvider privateApiRef={privateApiRef} configuration={configuration} props={props}>
<GridRoot
Expand All @@ -56,7 +58,7 @@ const DataGridPremiumRaw = forwardRef(function DataGridPremium<R extends GridVal
{...props.slotProps?.root}
ref={ref}
>
<Watermark packageName="x-data-grid-premium" releaseInfo={releaseInfo} />
{watermark}
</GridRoot>
</GridContextProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export const useDataGridPremiumComponent = (
/**
* Register all state initializers here.
*/
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
useGridInitializeState(aggregationStateInitializer, apiRef, props);
Expand All @@ -143,11 +142,12 @@ export const useDataGridPremiumComponent = (
useGridInitializeState(densityStateInitializer, apiRef, props);
useGridInitializeState(columnReorderStateInitializer, apiRef, props);
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
useGridInitializeState(dataSourceStateInitializer, apiRef, props);
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
useGridInitializeState(listViewStateInitializer, apiRef, props);

useGridRowGrouping(apiRef, props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const useGridAggregation = (
const currentModel = gridAggregationModelSelector(apiRef);
if (currentModel !== model) {
apiRef.current.setState(mergeStateWithAggregationModel(model));
apiRef.current.forceUpdate();
}
},
[apiRef],
Expand Down Expand Up @@ -147,7 +146,6 @@ export const useGridAggregation = (

// Re-apply the column hydration to wrap / unwrap the aggregated columns
if (!areAggregationRulesEqual(rulesOnLastColumnHydration, aggregationRules)) {
apiRef.current.caches.aggregation.rulesOnLastColumnHydration = aggregationRules;
apiRef.current.requestPipeProcessorsApplication('hydrateColumns');
}
}, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export const useGridAggregationPreProcessors = (
});

rulesOnLastColumnHydration.current = aggregationRules;

apiRef.current.caches.aggregation.rulesOnLastColumnHydration = aggregationRules;

return columnsState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
isNavigationKey,
serializeCellValue,
useGridRegisterPipeProcessor,
useGridVisibleRows,
} from '@mui/x-data-grid-pro/internals';
import {
useGridApiEventHandler,
Expand All @@ -26,7 +25,6 @@ import {
gridFocusCellSelector,
GridCellParams,
GRID_REORDER_COL_DEF,
useGridSelector,
gridSortedRowIdsSelector,
gridDimensionsSelector,
} from '@mui/x-data-grid-pro';
Expand Down Expand Up @@ -64,13 +62,10 @@ export const useGridCellSelection = (
>,
) => {
const hasRootReference = apiRef.current.rootElementRef.current !== null;
const visibleRows = useGridVisibleRows(apiRef, props);
const cellWithVirtualFocus = React.useRef<GridCellCoordinates>(null);
const lastMouseDownCell = React.useRef<GridCellCoordinates>(null);
const mousePosition = React.useRef<{ x: number; y: number }>(null);
const autoScrollRAF = React.useRef<number>(null);
const sortedRowIds = useGridSelector(apiRef, gridSortedRowIdsSelector);
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
const totalHeaderHeight = getTotalHeaderHeight(apiRef, props);

const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
Expand Down Expand Up @@ -145,6 +140,7 @@ export const useGridCellSelection = (
}

const visibleColumns = apiRef.current.getVisibleColumns();
const visibleRows = getVisibleRows(apiRef);
const rowsInRange = visibleRows.rows.slice(finalStartRowIndex, finalEndRowIndex + 1);
const columnsInRange = visibleColumns.slice(finalStartColumnIndex, finalEndColumnIndex + 1);

Expand All @@ -161,7 +157,7 @@ export const useGridCellSelection = (

apiRef.current.setCellSelectionModel(newModel);
},
[apiRef, visibleRows.rows],
[apiRef],
);

const getSelectedCellsAsArray = React.useCallback<
Expand Down Expand Up @@ -292,6 +288,8 @@ export const useGridCellSelection = (
return;
}

const dimensions = gridDimensionsSelector(apiRef.current.state);

const { x: mouseX, y: mouseY } = mousePosition.current;
const { width, height: viewportOuterHeight } = dimensions.viewportOuterSize;
const height = viewportOuterHeight - totalHeaderHeight;
Expand Down Expand Up @@ -331,7 +329,7 @@ export const useGridCellSelection = (
}

autoScroll();
}, [apiRef, dimensions, totalHeaderHeight]);
}, [apiRef, totalHeaderHeight]);

const handleCellMouseOver = React.useCallback<GridEventListener<'cellMouseOver'>>(
(params, event) => {
Expand All @@ -354,6 +352,7 @@ export const useGridCellSelection = (
return;
}

const dimensions = gridDimensionsSelector(apiRef.current.state);
const { x, y } = virtualScrollerRect;
const { width, height: viewportOuterHeight } = dimensions.viewportOuterSize;
const height = viewportOuterHeight - totalHeaderHeight;
Expand All @@ -378,7 +377,7 @@ export const useGridCellSelection = (
stopAutoScroll();
}
},
[apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight, dimensions],
[apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight],
);

const handleCellClick = useEventCallback<
Expand Down Expand Up @@ -438,6 +437,7 @@ export const useGridCellSelection = (
endColumnIndex -= 1;
}

const visibleRows = getVisibleRows(apiRef);
if (endRowIndex < 0 || endRowIndex >= visibleRows.rows.length) {
return;
}
Expand Down Expand Up @@ -490,6 +490,7 @@ export const useGridCellSelection = (

const addClassesToCells = React.useCallback<GridPipeProcessor<'cellClassName'>>(
(classes, { id, field }) => {
const visibleRows = getVisibleRows(apiRef);
if (!visibleRows.range || !apiRef.current.isCellSelected(id, field)) {
return classes;
}
Expand Down Expand Up @@ -538,7 +539,7 @@ export const useGridCellSelection = (

return newClasses;
},
[apiRef, visibleRows.range, visibleRows.rows],
[apiRef],
);

const canUpdateFocus = React.useCallback<GridPipeProcessor<'canUpdateFocus'>>(
Expand Down Expand Up @@ -566,6 +567,7 @@ export const useGridCellSelection = (
if (apiRef.current.getSelectedCellsAsArray().length <= 1) {
return value;
}
const sortedRowIds = gridSortedRowIdsSelector(apiRef.current.state);
const cellSelectionModel = apiRef.current.getCellSelectionModel();
const unsortedSelectedRowIds = Object.keys(cellSelectionModel);
const sortedSelectedRowIds = sortedRowIds.filter((id) =>
Expand Down Expand Up @@ -594,7 +596,7 @@ export const useGridCellSelection = (
}, '');
return copyData;
},
[apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter, sortedRowIds],
[apiRef, ignoreValueFormatter, clipboardCopyCellDelimiter],
);

useGridRegisterPipeProcessor(apiRef, 'isCellSelected', checkIfCellIsSelected);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { RefObject } from '@mui/x-internals/types';
import {
GridRowId,
GridRowTreeConfig,
GridFilterState,
GridFilterModel,
Expand Down Expand Up @@ -80,9 +79,9 @@ export const filterRowTreeFromGroupingColumns = (
params: FilterRowTreeFromTreeDataParams,
): Omit<GridFilterState, 'filterModel'> => {
const { apiRef, rowTree, isRowMatchingFilters, filterModel } = params;
const filteredRowsLookup: Record<GridRowId, boolean> = {};
const filteredChildrenCountLookup: Record<GridRowId, number> = {};
const filteredDescendantCountLookup: Record<GridRowId, number> = {};
const filteredRowsLookup: GridFilterState['filteredRowsLookup'] = {};
const filteredChildrenCountLookup: GridFilterState['filteredChildrenCountLookup'] = {};
const filteredDescendantCountLookup: GridFilterState['filteredDescendantCountLookup'] = {};
const filterCache = {};

const filterTreeNode = (
Expand Down Expand Up @@ -142,7 +141,9 @@ export const filterRowTreeFromGroupingColumns = (
}
}

filteredRowsLookup[node.id] = isPassingFiltering;
if (!isPassingFiltering) {
filteredRowsLookup[node.id] = false;
}

if (!isPassingFiltering) {
return 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const configuration = {
},
};
const releaseInfo = getReleaseInfo();
const watermark = <Watermark packageName="x-data-grid-pro" releaseInfo={releaseInfo} />;

const DataGridProRaw = forwardRef(function DataGridPro<R extends GridValidRowModel>(
inProps: DataGridProProps<R>,
Expand All @@ -34,6 +35,7 @@ const DataGridProRaw = forwardRef(function DataGridPro<R extends GridValidRowMod
if (process.env.NODE_ENV !== 'production') {
validateProps(props, propValidatorsDataGridPro);
}

return (
<GridContextProvider privateApiRef={privateApiRef} configuration={configuration} props={props}>
<GridRoot
Expand All @@ -43,7 +45,7 @@ const DataGridProRaw = forwardRef(function DataGridPro<R extends GridValidRowMod
{...props.slotProps?.root}
ref={ref}
>
<Watermark packageName="x-data-grid-pro" releaseInfo={releaseInfo} />
{watermark}
</GridRoot>
</GridContextProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export const useDataGridProComponent = (
/**
* Register all state initializers here.
*/
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
useGridInitializeState(detailPanelStateInitializer, apiRef, props);
Expand All @@ -128,11 +127,12 @@ export const useDataGridProComponent = (
useGridInitializeState(densityStateInitializer, apiRef, props);
useGridInitializeState(columnReorderStateInitializer, apiRef, props);
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
useGridInitializeState(dataSourceStateInitializer, apiRef, props);
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
useGridInitializeState(listViewStateInitializer, apiRef, props);

useGridHeaderFiltering(apiRef, props);
Expand Down
Loading