Skip to content

fix(table-core): preserve columnFiltersMeta in filterRowModelFromLeafs - #6557

Open
ErfanBagheri404 wants to merge 1 commit into
TanStack:mainfrom
ErfanBagheri404:fix/column-filters-meta-leaf-rows
Open

fix(table-core): preserve columnFiltersMeta in filterRowModelFromLeafs#6557
ErfanBagheri404 wants to merge 1 commit into
TanStack:mainfrom
ErfanBagheri404:fix/column-filters-meta-leaf-rows

Conversation

@ErfanBagheri404

@ErfanBagheri404 ErfanBagheri404 commented Aug 15, 2026

Copy link
Copy Markdown

Fixes #6074

When filterFromLeafRows is true, filterRowModelFromLeafs recreates each row via constructRow and copies columnFilters, but neglects to copy columnFiltersMeta. Users who store filter-rank metadata (e.g. for fuzzy-sort use cases) find their data wiped on every filter recalculation.

Copy columnFiltersMeta alongside columnFilters when building the filtered row model from leaf rows.

Summary by CodeRabbit

  • Bug Fixes
    • Preserved column filter metadata when filtering nested or hierarchical table rows.
    • Ensured filtered rows retain the metadata needed for consistent filtering behavior.

Fixes TanStack#6074

filterFromLeafRows recreates each row via constructRow and copies
columnFilters, but neglects to copy columnFiltersMeta. Users who store
filter-rank metadata (e.g. for fuzzy-sort use cases) find their data
wiped on every filter recalculation.

Copy columnFiltersMeta alongside columnFilters when building the
filtered row model from leaf rows.
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dacec9b5-4a6c-4a18-bc8f-65643f9a5798

📥 Commits

Reviewing files that changed from the base of the PR and between 5304f72 and 1ea36c0.

📒 Files selected for processing (1)
  • packages/table-core/src/features/column-filtering/filterRowsUtils.ts

📝 Walkthrough

Walkthrough

Leaf-first filtering now copies columnFiltersMeta when it reconstructs rows. This preserves filter metadata during recursive filtering.

Changes

Column filter metadata

Layer / File(s) Summary
Preserve metadata during row reconstruction
packages/table-core/src/features/column-filtering/filterRowsUtils.ts
Leaf-first filtering copies each original row’s columnFiltersMeta to its reconstructed row.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 1ea36

This is a localized metadata-preservation fix with no actionable merge-blocking risk remaining beyond normal checks and review.

Possibly related PRs

Suggested reviewers: kevinvandy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the fix to preserve columnFiltersMeta during leaf-row filtering.
Description check ✅ Passed The description explains the bug, motivation, linked issue, and fix, but omits the template checklist and release-impact sections.
Linked Issues check ✅ Passed The change copies columnFiltersMeta when reconstructing rows, which satisfies issue #6074 and preserves metadata for leaf and non-leaf rows.
Out of Scope Changes check ✅ Passed The only change directly addresses issue #6074 and the stated objective without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MILLERMARRU MILLERMARRU left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled the current filterRowsUtils.ts and confirmed the gap directly: filterRowModelFromRoot and filterRowModelFromLeafs both reconstruct rows via constructRow, but only the leaf-up path drops columnFiltersMeta on the copy while keeping columnFilters. Anything that reads per-row filter match metadata (e.g. highlighting the matched substring for a fuzzy filter) would silently lose it whenever filterFromLeafRows is enabled, with no equivalent loss in the root-down path. The fix is a one-line, symmetric addition that matches how columnFilters is already handled two lines above, so it's low risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

filterFromLeafRows causes columnFiltersMeta to get wiped

2 participants