diff --git a/packages/table-core/src/utils/getGroupedRowModel.ts b/packages/table-core/src/utils/getGroupedRowModel.ts index da97631913..810fbd4afe 100644 --- a/packages/table-core/src/utils/getGroupedRowModel.ts +++ b/packages/table-core/src/utils/getGroupedRowModel.ts @@ -72,7 +72,7 @@ export function getGroupedRowModel(): ( }) // Flatten the leaf rows of the rows in this group - const leafRows = depth + const leafRows = groupedRows.some((row) => row.subRows.length > 0) ? flattenBy(groupedRows, row => row.subRows) : groupedRows