fix(table-core): keep columnFiltersMeta when filtering from leaf rows - #6564
fix(table-core): keep columnFiltersMeta when filtering from leaf rows#6564dylanpulver wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLeaf-first filtering now preserves each row’s ChangesColumn filter metadata preservation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized fix preserves filter-ranking metadata when filtering from leaf rows and is covered by targeted tests; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
Fixes #6074
filterRowModelFromLeafsrebuilds every row withconstructRowand copiescolumnFiltersonto the copy but notcolumnFiltersMeta. SinceinitRowInstanceDatainitialises both maps as empty, the meta is notundefinedbut silently reset to{}, so the rank metadata a filter records throughaddMetais wiped and therowA.columnFiltersMeta[columnId]guard in the fuzzy-filtering guide's sort function skips instead of throwing. This copies the meta across alongsidecolumnFilters.Why a per-row copy rather than inheriting or aggregating.
_createFilteredRowModelalready tags every row of the pre-filtered model in a flat pre-pass, so meta is computed independently at every depth: the leaf-up path loses data that exists rather than data needing derivation. Inheriting the parent's meta would stamp a parent's rank onto its sub-rows and produce wrong sort order within a group instead of a visible break. Aggregating sub-row ranks into the parent would overwrite the parent's own score, which the issue author explicitly argued against, noting asortingFnalready hasrow.subRows.Nothing in
table-corereadscolumnFiltersMeta, so restoring it cannot change any filtering, faceting, or pagination result.Left alone deliberately:
filterRowModelFromRootclones matching parents withsubRowsand copies neither field, so those lose both under the default option. That path has an in-core consumer (row.columnFilters), so aligning the two is a broader decision than this bug covers. Happy to follow up separately.perf-todo.mdrecords this gap atfilterRowsUtils.ts:65as needing "a deliberate, documented decision either way".Tests in
createFilteredRowModel.test.ts, added to the existingcolumnFiltersMetadescribe block with a rank-scoringaddMetafilter: nested rows underfilterFromLeafRows: true(the retained non-matching parent keeps rank0rather than inheriting its child's, which pins per-row over inherited semantics), flat top-level rows under the same option, and flat rows on the default root-down path. The first two fail onmain, the third passes either way.Verified from
packages/table-core:npx vitest run(63 files, 1319 passed), the changed test file (36 passed, 2 failing with the src fix stashed),npx tscand the declaration-emit config,npx eslint ./src, andprettier --checkon changed files, all clean.pnpm run test:pris green for every lint, types, lib and build target; the only failures are the Angular example builds, which cannot run on my machine because the Angular CLI wants Node 24.15.0 and I am on 24.14.1.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Tests