Skip to content

fix(table-core): clear stale columnFiltersMeta in getFilteredRowModel#6161

Open
NehaChaudhary311 wants to merge 1 commit intoTanStack:mainfrom
NehaChaudhary311:fix/filtered-rowmodel-clear-columnfiltersmeta
Open

fix(table-core): clear stale columnFiltersMeta in getFilteredRowModel#6161
NehaChaudhary311 wants to merge 1 commit intoTanStack:mainfrom
NehaChaudhary311:fix/filtered-rowmodel-clear-columnfiltersmeta

Conversation

@NehaChaudhary311
Copy link

@NehaChaudhary311 NehaChaudhary311 commented Feb 5, 2026

🎯 Changes

This PR fixes a small issue in getFilteredRowModel where row.columnFiltersMeta could retain stale entries across filter updates.

What changed

Reset row.columnFiltersMeta = {} whenever row.columnFilters is reset during filtered row model recomputation.

Why

When switching/removing column filters, filter functions that previously wrote meta could leave old meta behind. Clearing columnFiltersMeta ensures meta always reflects the current filter run.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes

    • Improved table filtering reliability by ensuring column filter metadata is properly initialized and cleared between consecutive filter operations.
  • Tests

    • Added test coverage validating correct filter metadata behavior during filter state transitions.

@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

⚠️ No Changeset found

Latest commit: 4c549da

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This change adds initialization of a row.columnFiltersMeta metadata container in the getFilteredRowModel utility alongside the existing row.columnFilters initialization, ensuring per-column filter metadata is available from the start and properly cleared between filtering operations.

Changes

Cohort / File(s) Summary
Filter metadata initialization
packages/table-core/src/utils/getFilteredRowModel.ts
Adds initialization of row.columnFiltersMeta when preparing flat rows to ensure filter metadata is available and ready for population during filtering.
Filter metadata tests
packages/table-core/tests/getFilteredRowModel.test.ts
Introduces test coverage validating that columnFiltersMeta is properly cleared between consecutive filter operations, preventing metadata persistence across filter changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A whisker of metadata, initialized clean,
Per column, per row, a filtering machine,
When filters change course, the old fades away,
Fresh metadata blooms for the new filter day!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: clearing stale columnFiltersMeta in getFilteredRowModel, which matches the core change in the PR.
Description check ✅ Passed The description includes all required template sections with substantive content explaining the changes, motivation, and testing, though the Release Impact section shows no changeset was generated despite affecting published code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

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.

1 participant