Skip to content
Source
Sign inSign up
TanStack/table

fix(table-core): include sub-rows in flatRows when maxLeafRowFilterDepth truncates recursion #6361

ClosedJSap0914(GitHub profile, opens in a new tab)wants to merge 2 commits intobeta fromrefs/pull/6361/headopened

Showing 2 changed files with 171 additions and 0 deletions.

x
0 of 2 viewed, 2 left
28 additions and 0 deletionspackages/table-core/src/features/column-filtering/filterRowsUtils.tsModified
View file
@@ -101,6 +101,23 @@
​
+function addSubRowsToFlatArrays<
+ TFeatures extends TableFeatures,
+ TData extends RowData,
+>(
+ subRows: Array<Row<TFeatures, TData>>,
+ flatRows: Array<Row<TFeatures, TData>>,
+ rowsById: Record<string, Row<TFeatures, TData>>,
+): void {
+ for (const subRow of subRows) {
+ flatRows.push(subRow)
+ rowsById[subRow.id] = subRow
+ if (subRow.subRows.length) {
+ addSubRowsToFlatArrays(subRow.subRows, flatRows, rowsById)
+ }
+ }
+}
+​
function filterRowModelFromRoot<
TFeatures extends TableFeatures,
TData extends RowData,
@@ -144,6 +161,17 @@