From c9761032a20e5683c73a8163bcd96c44d6d7a5d4 Mon Sep 17 00:00:00 2001 From: Joel 'Aaron' Cohen Date: Mon, 4 Nov 2024 16:55:10 -0500 Subject: [PATCH] Ensure isSubRowSelected returns false if no subRows are selctable --- packages/table-core/src/features/RowSelection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/table-core/src/features/RowSelection.ts b/packages/table-core/src/features/RowSelection.ts index 90166823aa..e591951d70 100644 --- a/packages/table-core/src/features/RowSelection.ts +++ b/packages/table-core/src/features/RowSelection.ts @@ -635,6 +635,7 @@ export function isSubRowSelected( let allChildrenSelected = true let someSelected = false + let someSelectable = false row.subRows.forEach(subRow => { // Bail out early if we know both of these @@ -643,6 +644,7 @@ export function isSubRowSelected( } if (subRow.getCanSelect()) { + someSelectable = true if (isRowSelected(subRow, selection)) { someSelected = true } else { @@ -664,5 +666,7 @@ export function isSubRowSelected( } }) + if (!someSelectable) return false + return allChildrenSelected ? 'all' : someSelected ? 'some' : false }