Skip to content

fix global filtering with undefined first values - #6438

Merged
KevinVandy merged 3 commits into
betafrom
agent/fix-4783-global-filter-null-first
Jul 31, 2026
Merged

fix global filtering with undefined first values#6438
KevinVandy merged 3 commits into
betafrom
agent/fix-4783-global-filter-null-first

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Jul 18, 2026

Copy link
Copy Markdown
Member

What changed

  • determine default global-filter eligibility from the first non-nullish value in a column
  • preserve the existing behavior of enabling string and number columns only
  • add a regression test covering an undefined first value followed by searchable strings

Why

The default eligibility predicate sampled only the first row. When that row had an undefined value, the entire column was excluded from global filtering even when later rows contained valid strings or numbers. This made results depend on row order.

Validation

  • reproduced the failure on beta before applying the implementation change
  • table-core test suite: 52 files, 1,005 tests passed
  • table-core TypeScript and declaration-emit checks passed
  • table-core ESLint passed
  • Prettier and git diff checks passed

Closes #4783

Summary by CodeRabbit

  • Bug Fixes

    • Global filtering now correctly evaluates columns when the first row has a blank value.
    • Filtering works as expected when matching values appear in later rows.
    • Columns explicitly enabled for global filtering can now be filtered even when they contain object values, using a custom filter.
  • Tests

    • Added coverage for undefined values in the first row and explicitly enabled object-valued columns.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Global filtering now honors explicit enablement and checks the first non-null value in a column when determining filterability. A regression test covers filtering data where the first row’s value is undefined.

Changes

Global filtering fix

Layer / File(s) Summary
Non-null column value detection and regression coverage
packages/table-core/src/features/global-filtering/globalFilteringFeature.ts, packages/table-core/tests/implementation/features/column-filtering/createFilteredRowModel.test.ts
getColumnCanGlobalFilter honors enableGlobalFilter: true and uses the first non-null cell value for type detection. A test verifies that global filtering finds a later matching row when the first row is undefined.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • TanStack/table#6439: Modifies getColumnCanGlobalFilter and adds tests for explicit global-filter enablement on object-valued columns.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the fix for global filtering when the first column value is undefined.
Linked Issues check ✅ Passed The implementation and regression tests address the undefined-first-value global filtering bug described in [#4783].
Out of Scope Changes check ✅ Passed The code and test changes are directly related to fixing and validating global-filter eligibility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-4783-global-filter-null-first

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.

@nx-cloud

nx-cloud Bot commented Jul 18, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 19ea699

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 6m 15s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 51s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-31 00:11:58 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 18, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/alpine-table@6438

@tanstack/angular-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table@6438

@tanstack/angular-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table-devtools@6438

@tanstack/ember-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/ember-table@6438

@tanstack/lit-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/lit-table@6438

@tanstack/match-sorter-utils

npm i https://pkg.pr.new/TanStack/table/@tanstack/match-sorter-utils@6438

@tanstack/preact-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table@6438

@tanstack/preact-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table-devtools@6438

@tanstack/react-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table@6438

@tanstack/react-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table-devtools@6438

@tanstack/solid-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table@6438

@tanstack/solid-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table-devtools@6438

@tanstack/svelte-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/svelte-table@6438

@tanstack/table-core

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-core@6438

@tanstack/table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-devtools@6438

@tanstack/vue-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table@6438

@tanstack/vue-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table-devtools@6438

commit: 19ea699

@KevinVandy

Copy link
Copy Markdown
Member Author

credit to @SAY-5 for PRing a fix in #6252

@KevinVandy
KevinVandy marked this pull request as ready for review July 30, 2026 22:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/table-core/tests/implementation/features/column-filtering/createFilteredRowModel.test.ts (1)

551-577: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover the undefined-first-row regression directly.

This test exercises the explicit enableGlobalFilter: true branch, so it never validates the new first non-nullish lookup. Add a case with the first row’s value undefined, a later searchable string, and no explicit opt-in; assert that the later row is returned.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/table-core/tests/implementation/features/column-filtering/createFilteredRowModel.test.ts`
around lines 551 - 577, Extend the global filtering tests near the explicit
opt-in case with a column whose first row value is undefined and a later row
contains a searchable string, without setting enableGlobalFilter. Configure the
filter to match that string and assert that only the later row is returned,
covering the first non-nullish value lookup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@packages/table-core/tests/implementation/features/column-filtering/createFilteredRowModel.test.ts`:
- Around line 551-577: Extend the global filtering tests near the explicit
opt-in case with a column whose first row value is undefined and a later row
contains a searchable string, without setting enableGlobalFilter. Configure the
filter to match that string and assert that only the later row is returned,
covering the first non-nullish value lookup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4287a756-7fce-4b86-aada-f6438bc84c77

📥 Commits

Reviewing files that changed from the base of the PR and between ec312a8 and 19ea699.

📒 Files selected for processing (2)
  • packages/table-core/src/features/global-filtering/globalFilteringFeature.ts
  • packages/table-core/tests/implementation/features/column-filtering/createFilteredRowModel.test.ts

@KevinVandy
KevinVandy merged commit e321f3f into beta Jul 31, 2026
9 checks passed
@KevinVandy
KevinVandy deleted the agent/fix-4783-global-filter-null-first branch July 31, 2026 00:12
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.

Global Filter Fails When First Row Value is Undefined

1 participant