Skip to content

feat(table-core): Further improve tree-shaking across features - #6626

Open
KevinVandy wants to merge 1 commit into
mainfrom
perf/tree-shaking-round-2
Open

KevinVandy wants to merge 1 commit into
mainfrom
perf/tree-shaking-round-2

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Oct 9, 2026 •

Copy link
Copy Markdown
Member
  • The core no longer bundles column ordering, pinned header ordering, or the expanded-row display walk. New stubs in core/featureStubs.ts (orderLeafColumns, orderByColumnPinning, expandRowModel) call a function that column grouping, column pinning, or row expanding stores on the table in initTableInstanceData, the same way _aggregateColumnValue works. constructTable drops from 5.51 to 5.24 kB brotli, and a minimal React useTable from 8.49 to 8.21 kB.
  • Pinned display order now lives in one internal function, features/column-pinning/orderByColumnPinning.ts. It replaces the separate copies in core header groups, row_getVisibleCells, and cell selection's column order.
  • Column sizing, column ordering, cell selection, column pinning, row pinning, and the paginated row model read other features through stubs instead of importing their utils. They no longer bundle features the table doesn't register.
  • Start, center, and end total sizes now sum the visible leaf columns in each pinning region instead of reading header groups. A new test checks that they still equal the header row widths with group headers and hidden columns.
  • In production, tableMemo no longer gives each memo an onAfterUpdate wrapper when there is no callback. Creating 500k row memos used 289 MB of heap instead of 389 MB and ran about 20% faster.
  • Row aggregation checks process.env.NODE_ENV at each dev warning, so production builds drop the message strings.
  • Regenerated the devtools bundle sizes. Across the feature sets used by 38 React examples, bundles shrink by 283 B brotli on average. Four sets that combine column ordering, pinning, and visibility grow by 50 to 61 B.
  • Public types are unchanged apart from the doc comments on the three region total size methods.

Notes

_orderByColumnPinning, _orderGroupedColumns, and _expandRows are untyped private functions stored on the table behind @ts-ignore. Together they account for about 270 B of the core saving. Replacing them with public APIs or static imports is a possible follow-up.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Performance
    • Improved tree-shaking so applications can ship less table feature code when using selected feature combinations.
    • Reduced bundle sizes across the measured feature-selection cases.
  • Bug Fixes
    • Improved consistency of column ordering and sizing across grouped, hidden, and pinned columns.
    • Preserved expected row expansion behavior when expanded rows are displayed with pagination.

Keep column ordering, column pinning, and row expanding code out of the
core bundle, route more cross-feature reads through feature stubs, and
stop allocating unused onAfterUpdate wrappers in production memos.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab37dd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@tanstack/table-core Patch
@tanstack/table-devtools Patch
@tanstack/alpine-table Patch
@tanstack/angular-table-devtools Patch
@tanstack/angular-table Patch
@tanstack/ember-table Patch
@tanstack/lit-table Patch
@tanstack/octane-table Patch
@tanstack/preact-table-devtools Patch
@tanstack/preact-table Patch
@tanstack/react-table-devtools Patch
@tanstack/react-table Patch
@tanstack/solid-table-devtools Patch
@tanstack/solid-table Patch
@tanstack/svelte-table Patch
@tanstack/vue-table-devtools Patch
@tanstack/vue-table Patch

Not sure what this means? Click here to learn what changesets are.

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

@nx-cloud

nx-cloud Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit ab37dd3

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

☁️ Nx Cloud last updated this comment at 2026-10-09 20:41:54 UTC

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

2 package(s) bumped directly, 15 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/table-core 9.2.8 → 9.2.9 Changeset
@tanstack/table-devtools 9.2.8 → 9.2.9 Changeset
@tanstack/alpine-table 9.2.8 → 9.2.9 Dependent
@tanstack/angular-table 9.2.8 → 9.2.9 Dependent
@tanstack/angular-table-devtools 9.2.8 → 9.2.9 Dependent
@tanstack/ember-table 9.2.8 → 9.2.9 Dependent
@tanstack/lit-table 9.2.8 → 9.2.9 Dependent
@tanstack/octane-table 9.2.8 → 9.2.9 Dependent
@tanstack/preact-table 9.2.8 → 9.2.9 Dependent
@tanstack/preact-table-devtools 9.2.8 → 9.2.9 Dependent
@tanstack/react-table 9.2.8 → 9.2.9 Dependent
@tanstack/react-table-devtools 9.2.8 → 9.2.9 Dependent
@tanstack/solid-table 9.2.8 → 9.2.9 Dependent
@tanstack/solid-table-devtools 9.2.8 → 9.2.9 Dependent
@tanstack/svelte-table 9.2.8 → 9.2.9 Dependent
@tanstack/vue-table 9.2.8 → 9.2.9 Dependent
@tanstack/vue-table-devtools 9.2.8 → 9.2.9 Dependent

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 6187e736-c167-40f3-99db-568540cf2573

📥 Commits

Reviewing files that changed from the base of the PR and between d8ae30b and ab37dd3.


📒 Files selected for processing (22)
  • .changeset/quiet-features-shake.md
  • packages/table-core/src/core/columns/coreColumnsFeature.utils.ts
  • packages/table-core/src/core/featureStubs.ts
  • packages/table-core/src/core/headers/coreHeadersFeature.utils.ts
  • packages/table-core/src/core/rows/coreRowsFeature.utils.ts
  • packages/table-core/src/features/cell-selection/cellSelectionFeature.utils.ts
  • packages/table-core/src/features/column-grouping/columnGroupingFeature.ts
  • packages/table-core/src/features/column-ordering/columnOrderingFeature.utils.ts
  • packages/table-core/src/features/column-pinning/columnPinningFeature.ts
  • packages/table-core/src/features/column-pinning/columnPinningFeature.utils.ts
  • packages/table-core/src/features/column-pinning/orderByColumnPinning.ts
  • packages/table-core/src/features/column-sizing/columnSizingFeature.utils.ts
  • packages/table-core/src/features/column-visibility/columnVisibilityFeature.utils.ts
  • packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts
  • packages/table-core/src/features/row-expanding/rowExpandingFeature.ts
  • packages/table-core/src/features/row-pagination/createPaginatedRowModel.ts
  • packages/table-core/src/features/row-pinning/rowPinningFeature.utils.ts
  • packages/table-core/src/utils.ts
  • packages/table-core/tests/unit/core/columns/coreColumnsFeature.utils.test.ts
  • packages/table-core/tests/unit/features/column-sizing/columnSizingFeature.utils.test.ts
  • packages/table-devtools/src/bundleSizes.ts
  • packages/table-devtools/tests/fixtures/bundleSizeValidation.json

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

Core utilities now use shared fallbacks for optional column and row features. Column ordering, pinning, visibility, and row expansion call these helpers. The changes also update callback and warning handling, column-size calculations, and devtools bundle measurements.

Changes

Optional-feature tree-shaking and bundle data

Layer / File(s) Summary
Leaf-column ordering
packages/table-core/src/core/featureStubs.ts, packages/table-core/src/core/columns/coreColumnsFeature.utils.ts, packages/table-core/src/features/column-grouping/columnGroupingFeature.ts, packages/table-core/tests/unit/core/columns/coreColumnsFeature.utils.test.ts
Shared helpers apply column ordering or grouped-column ordering when available, and otherwise preserve definition order. Grouping stores its ordering helper. Tests cover definition order, grouping, removal mode, and combined ordering and grouping.
Column visibility, pinning, and sizing
packages/table-core/src/core/featureStubs.ts, packages/table-core/src/core/headers/coreHeadersFeature.utils.ts, packages/table-core/src/features/cell-selection/cellSelectionFeature.utils.ts, packages/table-core/src/features/column-pinning/*, packages/table-core/src/features/column-visibility/columnVisibilityFeature.utils.ts, packages/table-core/src/features/column-ordering/columnOrderingFeature.utils.ts, packages/table-core/src/features/column-sizing/columnSizingFeature.utils.ts, packages/table-core/tests/unit/features/column-sizing/columnSizingFeature.utils.test.ts
Header, cell, ordering, and sizing utilities use shared visibility and pinning helpers. Column-size totals now sum visible leaf-column sizes for each pinning region. Tests cover grouped columns, pinning, and a hidden column.
Row expansion fallbacks
packages/table-core/src/core/featureStubs.ts, packages/table-core/src/core/rows/coreRowsFeature.utils.ts, packages/table-core/src/features/row-expanding/rowExpandingFeature.ts, packages/table-core/src/features/row-pagination/createPaginatedRowModel.ts, packages/table-core/src/features/row-pinning/rowPinningFeature.utils.ts
Display ordering and pagination use a shared row-expansion fallback. The row-expanding feature stores the expansion helper, and row pinning uses a shared parent-expansion check.
Optional callbacks and development warnings
packages/table-core/src/utils.ts, packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts
tableMemo creates an after-update handler only when a callback exists. Aggregation warnings check development mode inline; their conditions and messages remain unchanged.
Release and bundle measurements
.changeset/quiet-features-shake.md, packages/table-devtools/src/bundleSizes.ts, packages/table-devtools/tests/fixtures/bundleSizeValidation.json
The changeset marks patch releases for table-core and table-devtools. Devtools bundle measurements and feature-selection fixture values are updated for table-core 9.2.8.

Priority: ➖ Normal

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

Change: Refactor


Merge Risk: ⚪ Minimal · up to ab37d

This change reduces bundle size by moving optional feature code behind shared fallbacks. Behavior is intended to stay the same, and the new tests cover the pinned-region total-size and leaf-column ordering paths. No merge-blocking risk was identified.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description gives a detailed and relevant summary of the implementation, performance results, bundle-size changes, and follow-up notes. It does not include the required Changes, Checklist, or Rele… Add the repository template sections. Include the Changes section, complete each Checklist item, and confirm whether the change affects published code and whether a changeset was generated. Also state the test commands run or explain why th…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: further tree-shaking improvements across table-core features.
Docstring Coverage Passed Docstring coverage is 80.85% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 20 files. (2 skipped: 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Description check

Explanation

The description gives a detailed and relevant summary of the implementation, performance results, bundle-size changes, and follow-up notes. It does not include the required Changes, Checklist, or Release Impact sections, and it does not confirm the required testing, contributing-guide review, AI-assisted code review, or changeset status.

Resolution

Add the repository template sections. Include the Changes section, complete each Checklist item, and confirm whether the change affects published code and whether a changeset was generated. Also state the test commands run or explain why they do not apply.



  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

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

@tanstack/angular-table

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

@tanstack/angular-table-devtools

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

@tanstack/ember-table

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

@tanstack/lit-table

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

@tanstack/match-sorter-utils

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

@tanstack/octane-table

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

@tanstack/preact-table

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

@tanstack/preact-table-devtools

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

@tanstack/react-table

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

@tanstack/react-table-devtools

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

@tanstack/solid-table

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

@tanstack/solid-table-devtools

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

@tanstack/svelte-table

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

@tanstack/table-core

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

@tanstack/table-devtools

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

@tanstack/vue-table

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

@tanstack/vue-table-devtools

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

commit: ab37dd3

This branch has not been deployed

No deployments
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