Skip to content

fix(react-table): accept built-in fn names in legacy column helper - #6521

Merged
KevinVandy merged 3 commits into
TanStack:mainfrom
lazerg:fix-6520-legacy-fn-names
Aug 7, 2026
Merged

fix(react-table): accept built-in fn names in legacy column helper#6521
KevinVandy merged 3 commits into
TanStack:mainfrom
lazerg:fix-6520-legacy-fn-names

Conversation

@lazerg

@lazerglazerg commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

legacyCreateColumnHelper binds StockFeatures, which carries no filterFns, sortFns, or aggregationFns registry. ExtractAggregationFnKeys and its filter/sort counterparts then fall back to the declaration-merged interfaces, which are empty by default, so aggregationFn: 'mean' fails to type-check even though useLegacyTable spreads all three built-in registries into the features it builds at runtime.

The legacy types now use a LegacyFeatures set that extends StockFeatures with those three registries, so the string identifiers resolve. Names added through declaration merging keep working.

Fixes#6520

✅ Checklist

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

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.

Summary by CodeRabbit

  • New Features

    • Legacy table columns now support built-in and custom filtering, sorting, and aggregation functions by name.
    • Improved type support is available for legacy table helpers, columns, rows, and row-model features.
  • Bug Fixes

    • Legacy tables now correctly recognize configured filter, sort, and aggregation functions.
  • Tests

    • Added coverage for built-in and custom filtering, sorting, and aggregation behavior.

@coderabbitai

coderabbitaiBot commented Aug 6, 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: 2889e63a-e4ad-4a71-baeb-29139a30646c

📥 Commits

Reviewing files that changed from the base of the PR and between df470c5 and 82905e8.

📒 Files selected for processing (3)
  • .changeset/legacy-column-helper-fn-names.md
  • packages/react-table/src/useLegacyTable.ts
  • packages/react-table/tests/useLegacyTable.test.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/react-table/tests/useLegacyTable.test.tsx
  • packages/react-table/src/useLegacyTable.ts
  • .changeset/legacy-column-helper-fn-names.md

📝 Walkthrough

Walkthrough

useLegacyTable now uses LegacyFeatures, which includes typed built-in and custom filter, sort, and aggregation registries. Legacy helpers and row-model types use the same feature type. Tests cover built-in and custom registry functions.

Changes

Legacy feature registry support

Layer / File(s)Summary
Legacy feature type contracts
packages/react-table/src/useLegacyTable.ts
LegacyFeatures combines stock features with typed aggregation, filter, and sort registries. Legacy options, aliases, factories, state, and column helpers now use LegacyFeatures.
Runtime wiring and integration validation
packages/react-table/src/useLegacyTable.ts, packages/react-table/tests/useLegacyTable.test.tsx, .changeset/legacy-column-helper-fn-names.md
useLegacyTable constructs and subscribes to a LegacyFeatures table. Tests verify built-in and declaration-merged aggregation, filtering, and sorting functions. The changeset documents the supported function names.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly describes the primary change: enabling built-in function names in the legacy column helper.
Description check✅ PassedThe description includes the required changes, checklist, release impact, testing status, changeset, and linked issue.
Linked Issues check✅ PassedThe changes make built-in aggregation, filter, and sort identifiers type-check with legacyCreateColumnHelper, satisfying issue #6520.
Out of Scope Changes check✅ PassedThe implementation, tests, and changeset directly support the linked issue and stated pull request objectives.
Docstring Coverage✅ PassedNo 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.

@lazerg
lazergforce-pushed the fix-6520-legacy-fn-names branch from 7b9f0b3 to 32f7f4cCompareAugust 6, 2026 11:53
@coderabbitai

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitaicoderabbitaiBot 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.

🧹 Nitpick comments (1)
packages/react-table/tests/useLegacyTable.test.tsx (1)

18-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for declaration-merged custom names.

These columns cover only built-in identifiers. The PR also preserves custom names added through declaration merging. Add a compile-time fixture that augments FilterFns, SortFns, and AggregationFns, then constructs columns with those names. If the fixture runs through useLegacyTable, register matching implementations in the table options.

🤖 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/react-table/tests/useLegacyTable.test.tsx` around lines 18 - 23,
Extend the test fixture around legacyCreateColumnHelper and useLegacyTable to
declaration-merge custom entries into FilterFns, SortFns, and AggregationFns,
then construct columns using those custom names to provide compile-time
coverage. If the columns are passed through useLegacyTable, add matching
implementations to its table options.
🤖 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.
Nitpick comments:
In `@packages/react-table/tests/useLegacyTable.test.tsx`:
- Around line 18-23: Extend the test fixture around legacyCreateColumnHelper and
useLegacyTable to declaration-merge custom entries into FilterFns, SortFns, and
AggregationFns, then construct columns using those custom names to provide
compile-time coverage. If the columns are passed through useLegacyTable, add
matching implementations to its table options.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c12bf72-438c-4b0b-9347-b30afdb174fd

📥 Commits

Reviewing files that changed from the base of the PR and between 50feff8 and 32f7f4c.

📒 Files selected for processing (3)
  • .changeset/legacy-column-helper-fn-names.md
  • packages/react-table/src/useLegacyTable.ts
  • packages/react-table/tests/useLegacyTable.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-table/src/useLegacyTable.ts

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 82905e8

CommandStatusDurationResult
nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded4m 54sView ↗
nx run-many --targets=build --exclude=examples/**✅ Succeeded30sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-07 12:10:13 UTC

@coderabbitai

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@pkg-pr-new

pkg-pr-newBot commented Aug 7, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

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

@tanstack/angular-table

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

@tanstack/angular-table-devtools

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

@tanstack/ember-table

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

@tanstack/lit-table

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

@tanstack/match-sorter-utils

npm i https://pkg.pr.new/@tanstack/match-sorter-utils@6521

@tanstack/octane-table

npm i https://pkg.pr.new/@tanstack/octane-table@6521

@tanstack/preact-table

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

@tanstack/preact-table-devtools

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

@tanstack/react-table

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

@tanstack/react-table-devtools

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

@tanstack/solid-table

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

@tanstack/solid-table-devtools

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

@tanstack/svelte-table

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

@tanstack/table-core

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

@tanstack/table-devtools

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

@tanstack/vue-table

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

@tanstack/vue-table-devtools

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

commit: 82905e8

@KevinVandy
KevinVandy merged commit 10accb2 into TanStack:mainAug 7, 2026
10 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Aug 7, 2026
Sign up for freeto 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.

[TypeScript] aggregationFn cannot be set to one of the built-in string identifiers when using legacyCreateColumnHelper

2 participants

@lazerg@KevinVandy