Skip to content

fix(react-table): type aggregatedCell against bound cellComponents in createAppColumnHelper - #6584

Open
nirmal-shaji wants to merge 1 commit into
TanStack:mainfrom
nirmal-shaji:fix/apphelper-aggregatedcell-6583
Open

fix(react-table): type aggregatedCell against bound cellComponents in createAppColumnHelper#6584
nirmal-shaji wants to merge 1 commit into
TanStack:mainfrom
nirmal-shaji:fix/apphelper-aggregatedcell-6583

Conversation

@nirmal-shaji

@nirmal-shaji nirmal-shaji commented Sep 4, 2026

Copy link
Copy Markdown

Problem

createAppColumnHelper (from createTableHook) returns column-definition types whose render props are enhanced with the registered cellComponents / headerComponents, so you can write cell: ({ cell }) => <cell.MyCell />. This worked for cell, header, and footer, but not for aggregatedCell: inside it the cell render prop was the plain core Cell, with no bound components, so ({ cell }) => <cell.MyCell /> was a type error.

Fixes #6583

Cause

AppColumnDefBase (and its siblings AppDisplayColumnDef / AppGroupColumnDef) Omit the core cell | header | footer keys and re-declare them against the enhanced AppCellContext / AppHeaderContext. aggregatedCell — contributed by rowAggregationFeature and typed against the cell context, exactly like cell — was never part of that omit-and-enhance set, so it retained its core type.

Fix

Add 'aggregatedCell' to the omitted keys and re-declare it mirroring cell (both share the cell context) in AppColumnDefBase, AppDisplayColumnDef, and AppGroupColumnDef. This is a type-only, localized change; the runtime column helper is untouched (components are still bound at render time). JSDoc that enumerates the bound contexts was updated to mention aggregatedCell.

Testing

  • Added packages/react-table/tests/createAppColumnHelper.test-d.tsx, a type-level test (checked by tsc via test:types, excluded from the vitest run by its .test-d. name) asserting aggregatedCell accepts a bound component name across accessor / display / group, with a @ts-expect-error guard that an unregistered component is still rejected. Confirmed it fails before the fix and passes after.
  • pnpm --filter @tanstack/react-table test:types → passes.
  • pnpm --filter @tanstack/react-table test:lib → 6 files, 34 tests passing.
  • ESLint on the changed files → clean.

Summary by CodeRabbit

  • New Features

    • Added support for custom rendering of aggregated cell values across accessor, display, and group columns.
    • Registered cell components are now available when rendering aggregated cells, with type checking to prevent unsupported components.
  • Tests

    • Added type-level coverage validating aggregated-cell rendering and component registration across column helpers.

… createAppColumnHelper

The `App*` column definition types produced by `createAppColumnHelper`
enhanced only `cell`, `header`, and `footer` with the registered
`cellComponents` / `headerComponents`. `aggregatedCell` (added by
`rowAggregationFeature`) was left with its core type, so its render prop
`cell` did not expose the bound components the way `cell` does.

Add `aggregatedCell` to the omitted keys and re-declare it mirroring
`cell` (it shares the cell context) in `AppColumnDefBase`,
`AppDisplayColumnDef`, and `AppGroupColumnDef`. Type-only change.

Fixes TanStack#6583
@coderabbitai

coderabbitai Bot commented Sep 4, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 1f2d1d39-59c6-4a12-8363-c8143ce2138d

📥 Commits

Reviewing files that changed from the base of the PR and between 36733a3 and 3ff4133.

📒 Files selected for processing (2)
  • packages/react-table/src/createTableHook.tsx
  • packages/react-table/tests/createAppColumnHelper.test-d.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The React Table column definition types now support aggregatedCell with bound cell components. New TypeScript tests validate this behavior for accessor, display, and group column helpers.

Changes

Aggregated cell typing

Layer / File(s) Summary
Aggregated cell column contracts
packages/react-table/src/createTableHook.tsx
The application column definition types omit the base aggregatedCell property and add an enhanced context. JSDoc now documents bound components in aggregated cell contexts.
Aggregated cell type validation
packages/react-table/tests/createAppColumnHelper.test-d.tsx
Type-level tests verify registered components in aggregatedCell contexts and reject unregistered components for accessor, display, and group helpers.

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

Merge Risk: ⚪ Minimal · up to 3ff41

Aggregated-cell render props now expose registered cell components consistently with other column render props, resolving the TypeScript limitation without changing runtime behavior. No current merge-blocking risk remains.

Suggested reviewers: kevinvandy

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: typing aggregatedCell against bound cellComponents in createAppColumnHelper.
Description check ✅ Passed The description clearly explains the problem, cause, fix, scope, and test coverage. It does not use the template headings or include the checklist and release-impact sections, but the required technic…
Linked Issues check ✅ Passed The PR satisfies issue #6583 by adding aggregatedCell to the omitted core keys and typing it with the enhanced cell context. The tests cover accessor, display, and group columns, including rejection…
Out of Scope Changes check ✅ Passed The changes are limited to the requested type declarations, related JSDoc updates, and focused type-level tests. No unrelated runtime or product changes are present.
  • Fix all pre-merge checks with AI
✨ 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.

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.

aggregatedCell not typed against bound cellComponents in createAppColumnHelper

1 participant