Skip to content
Source
Sign inSign up
TanStack/table

fix(react-table): type aggregatedCell against bound cellComponents in createTableHook #6603

Closedgrzdev(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/6603/headopened

Summary

In createTableHook, AppColumnDefBase and AppDisplayColumnDef enhance cell, header, and footer templates with bound cellComponents and headerComponents via AppCellContext and AppHeaderContext. However, aggregatedCell was not omitted from the base definition and re-typed with AppCellContext, leaving it typed against the standard CellContext. As a result, referencing bound cell components in an aggregatedCell renderer reported TypeScript errors unless cast.

Changes

  • Updated AppColumnDefBase and AppDisplayColumnDef in createTableHook.tsx to omit aggregatedCell and type it with AppCellContext containing TCellComponents.
  • Added test coverage in packages/react-table/tests/createTableHook.test.tsx verifying type-checking and usage of bound cell components within aggregatedCell.
  • Added changeset declaring a patch release for @tanstack/react-table.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed type checking for aggregated cells so their renderers can use registered cell components.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: TanStack/table/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: cf528fef-e0e8-40a9-be12-3d043a4e41db

      📥 Commits

      Reviewing files that changed from the base of the PR and between 21d713fc4947d2a08cc2136bb055889a61412ded and 0c8d4130372ef2ff768b825ef450f9263f59d8f3.

      📒 Files selected for processing (3)
      • .changeset/fix-aggregated-cell-bound-components.md
      • packages/react-table/src/createTableHook.tsx
      • packages/react-table/tests/createTableHook.test.tsx

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


      📝 Walkthrough

      Walkthrough

      Aggregate-cell templates in two column definition types now use AppCellContext, including registered cell components. The test adds a NameCell aggregate renderer, and a changeset records the fix.

      Changes

      Aggregate cell template typing

      Layer / File(s)Summary
      Type aggregate-cell templates
      packages/react-table/src/createTableHook.tsx, packages/react-table/tests/createTableHook.test.tsx, .changeset/fix-aggregated-cell-bound-components.md
      AppColumnDefBase and AppDisplayColumnDef declare aggregatedCell templates with AppCellContext. The test adds a NameCell renderer, and the changeset describes the typing fix.

      Priority: ⬇️ Low

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

      Change: Bug fix

      Suggested reviewers: kevinvandy

      Merge Risk: ⚪ Minimal · up to 0c8d4

      The change aligns aggregate-cell typing with the bound cell components available during React rendering. No merge-blocking risk is evident; proceed with normal checks.

      Security Architecture Review

      Security architecture risk: ⚪ Minimal · up to 0c8d4

      Aggregate-cell renderers gain type-safe access to registered cell components. The reviewed change does not alter how cells are rendered or introduce a new security boundary or capability.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The effective change is to developer-facing React callback typing, not to the runtime set of reachable templates or registered components on the inspected rendering path.

      Trust Boundaries and Controls

      • inferred — No control is bypassed by the inspected type specialization: the existing AppCell component-binding step and FlexRender invocation remain the path by which an aggregate template receives its context.
      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely identifies the primary change: typing aggregatedCell against bound cellComponents in createTableHook.
      Description check✅ PassedThe description clearly explains the problem, implementation, test coverage, and changeset. It does not use the template's ## 🎯 Changes, ## ✅ Checklist, or ## 🚀 Release Impact headings, but it i…
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      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.
    2. TkDodo closed this

Sign in to join this conversation.