From f50938c40ac76dba7a02ea883c54b685c9503a74 Mon Sep 17 00:00:00 2001 From: Bilal Shafi Date: Tue, 5 Nov 2024 18:04:51 +0500 Subject: [PATCH] [DataGrid] Fix failing CI (#15273) --- .../src/hooks/features/rowSelection/useGridRowSelection.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/x-data-grid/src/hooks/features/rowSelection/useGridRowSelection.ts b/packages/x-data-grid/src/hooks/features/rowSelection/useGridRowSelection.ts index c197b147205a..7fc8dd13d2cc 100644 --- a/packages/x-data-grid/src/hooks/features/rowSelection/useGridRowSelection.ts +++ b/packages/x-data-grid/src/hooks/features/rowSelection/useGridRowSelection.ts @@ -339,8 +339,8 @@ export const useGridRowSelection = ( } const currentLookup = selectedIdsLookupSelector(apiRef); if ( - newSelection.length === Object.keys(currentLookup).length && - newSelection.every((id) => currentLookup[id] === id) + newSelection.size === Object.keys(currentLookup).length && + Array.from(newSelection).every((id) => currentLookup[id] === id) ) { return; } @@ -504,11 +504,10 @@ export const useGridRowSelection = ( // Example: A parent whose de-selected children are filtered out should now be selected const shouldReapplyPropagation = isNestedData && - !sortModelUpdated && props.rowSelectionPropagation?.parents && Object.keys(selectionLookup).length > 0; - if (hasChanged || shouldReapplyPropagation) { + if (hasChanged || (shouldReapplyPropagation && !sortModelUpdated)) { const newSelection = Object.values(selectionLookup); if (shouldReapplyPropagation) { apiRef.current.selectRows(newSelection, true, true);