Skip to content

@octanejs/tanstack-table: complete @tanstack/react-table 8.21.3 binding (+ keyed-@for survivor-skip soundness fix) - #44

Merged
trueadm merged 1 commit into
mainfrom
worktree-tanstack-table
Jul 11, 2026
Merged

trueadm merged 1 commit into
mainfrom
worktree-tanstack-table

Conversation

@trueadm

@trueadm trueadm commented Jul 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

New @octanejs/tanstack-table binding — a complete 1:1 port of @tanstack/react-table 8.21.3 completing the TanStack suite (query, router, table) — plus a keyed-@for compiler soundness fix the port exposed.

The binding

  • @tanstack/table-core reused verbatim and re-exported; both catalog entries are exact-pinned to 8.21.3 (react-table's only dep is table-core at the same version — a caret would let the differential oracle drift from the shipped core).
  • useReactTable transcribed line-for-line onto octane hooks, preserving upstream's useState-based shape (create-once instance, state in useState wired into onStateChange, render-phase setOptions re-composition) — so partially-controlled state, onStateChange passthrough, and table-core's functional Updater<T> contract behave exactly as on React. Slot forwarding via the shared subSlot helpers.
  • flexRender: components render through octane's createElement descriptor at value position; strings/numbers/pre-created elements pass through. Upstream's class-component and react.memo/forwardRef exotic-object branches are dropped — provably dead in octane (no classes/forwardRef; memo() returns a plain function, covered by a memo-wrapped-cell test). The upstream !Comp falsy quirk (''/0 → null) is pinned as parity, not fixed.

Compiler fix: keyed @for stale-survivor soundness

The canonical TanStack header markup — {header.column.getIsSorted()} inside the header @for — rendered stale: table-core memoizes header objects, so the PURE/DEP-PURE survivor short-circuit skipped ref-stable items whose bodies read changed state through a method call. React re-runs bodies unconditionally.

Fix in compile.js's body analysis: containsRenderCall disqualifies bodies executing any call during render (calls can read state neither the item ref nor the deps tuple witnesses). Calls deferred inside event-handler closures stay eligible, and property-read-only bodies keep the promotion — the js-framework-benchmark row shape still compiles with full flags (14 = singleRoot + depEligible + indexIndependent), so the measured perf wins are intact. Regression pinned in packages/octane/tests/for.test.ts (CallBodyList), contrasted with the existing DepPureList (bare module-var reads remain documented at-your-own-risk). Separate octane patch changeset included.

Tests (35 in the new tanstack-table project)

  • Core wiring (ports upstream core.test.tsx + the matrix upstream doesn't have): markup render, stable instance identity, rowModel, data/columns swaps through render-phase setOptions, uncontrolled sorting asc→desc→cleared, partially-controlled state.sorting + onSortingChange, onStateChange passthrough with internal state still applied, queued functional updaters within one event, and a one-click-one-render probe.
  • flexRender triage: string/render-fn/component (full cell context props)/undefined/pre-created-descriptor/memo-wrapped, plus the falsy quirk.
  • Feature smokes: column + global filtering, faceting, button-driven pagination (windows, canPrev/canNext, setPageSize), row selection incl. predicate select-all (semantics verified against the real core: getIsAllRowsSelected counts only selectable rows → isAll AND isSome both true), column visibility with group-header colSpan, nested expanding with keyed-row DOM-node identity, grouping + aggregatedCell.
  • Export parity vs real @tanstack/react-table + core-instance identity (both rig sides share one table-core).
  • 5 differential fixtures byte-identical vs real react-table on React: basic (all flexRender shapes + data swap), sorting (incl. sortRemoval + single-sort replace), filter+pagination (incl. pageSize-change pageIndex-reset parity), selection (predicate select-all; checkboxes via the controlled-forms onClick precedent, state surfaced as text/data attrs since checked is invisible to innerHTML), visibility+expanding (incl. collapse-with-retained-child-expansion).

Reviewer notes

  • Sorting clicks queue a second state update (pageIndex auto-reset) — fixtures needing clean render counts set autoResetPageIndex: false; the differential pins the default double-update behavior byte-for-byte.
  • Grouped header ids are depth-mangled (1_name_firstName) — tests query structurally.
  • No <select> in differential fixtures (the rig has no change driver); page size via buttons.
  • status.json notes column sizing/pinning drag interactions are untested-by-interaction (jsdom/rig has no mousemove); their state APIs are verbatim table-core computation.

Validation

  • pnpm test: 762/764 files passed (2 skipped), 5,927 tests passed (8 expected-fail pins, 1 skip, 58 todo)
  • pnpm typecheck, pnpm format:check, pnpm bindings:status:check, pnpm changeset:check all green
  • octane dev + prod projects: 4,037 tests green with the compiler change

🤖 Generated with Claude Code


Note

Medium Risk
The compile.js @for purity change affects reconciliation for all keyed lists app-wide; mitigated by targeted tests and preserved read-only optimizations, while the large new binding is heavily differential-tested.

Overview
Adds @octanejs/tanstack-table, a 1:1 port of @tanstack/[email protected]: @tanstack/table-core is re-exported unchanged; useReactTable and flexRender are transcribed onto octane hooks (including hook subSlot forwarding). Export parity and byte-identical differential tests vs real react-table cover sorting, filtering, pagination, selection, visibility, and expanding.

Fixes a keyed @for compiler soundness bug exposed by table headers: containsRenderCall now blocks PURE/DEP-PURE survivor short-circuit when the item body has render-time calls (e.g. header.column.getIsSorted() on stable memoized items), so bodies re-run each parent render like React. Property-only bodies and calls inside event handlers stay optimizable. Regression: CallBodyList in for.test.ts; separate octane patch changeset.

Wires the binding into bindings status, root typecheck, vitest tanstack-table project + differential precompile, and MCP KNOWN_BINDINGS / bridge skill table.

Reviewed by Cursor Bugbot for commit 0a35609. Bugbot is set up for automated code reviews on this repo. Configure here.

New binding completing the TanStack suite (query, router, now table):
@tanstack/table-core is reused verbatim (both catalog entries exact-pinned
to 8.21.3 so the differential oracle shares the shipped core); the ~100-line
React adapter (useReactTable, flexRender) is transcribed onto octane hooks
preserving upstream's useState-based state wiring. flexRender renders
component cells through octane's createElement descriptors; upstream's
class-component and memo/forwardRef exotic branches are dropped (octane's
memo() returns a plain function — proven by a memo-wrapped cell test).

Also fixes a keyed-@for compiler soundness bug the port exposed: the
PURE/DEP-PURE survivor short-circuit rendered STALE output when an item
body contained a render-time call reading mutable state through a
ref-stable item — the canonical TanStack header markup
(header.column.getIsSorted() on table-core's memoized header objects).
compile.js's body analysis now disqualifies call-bearing bodies
(containsRenderCall); calls deferred inside event-handler closures stay
eligible, and property-read-only bodies (the measured js-framework-
benchmark/dbmon wins, flags=14 verified) keep the promotion. Regression
pinned in packages/octane/tests/for.test.ts (CallBodyList).

- 35 tests: core wiring (stable instance, data/columns swaps, controlled +
  passthrough state, functional-updater contract, render-count probe),
  flexRender triage (string/fn/component/undefined/descriptor/memo + the
  upstream !Comp falsy quirk pinned), feature smokes (column/global filter,
  faceting, pagination, selection incl. predicate select-all semantics,
  visibility + group colSpan, nested expanding with DOM identity,
  grouping/aggregation), export parity + core-instance identity.
- 5 differential fixtures byte-identical vs real @tanstack/react-table:
  basic/sorting/filter-paginate/selection/visibility-expand. Checkboxes use
  the controlled-forms onClick precedent; selection surfaced as text/data
  attrs (checked is a DOM property, invisible to innerHTML); no <select>
  (the rig has no change driver).
- Wiring: vitest project + aliases, typecheck chain, catalog pins,
  status.json + regenerated bindings table (16), README, changesets
  (binding + octane compiler fix), hook-slot registry pin, MCP
  KNOWN_BINDINGS + bridge skill rows.

Co-Authored-By: Claude Fable 5 <[email protected]>
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 11, 2026 10:01pm

Request Review

@trueadm
trueadm merged commit 8de4584 into main Jul 11, 2026
6 checks passed
@trueadm
trueadm deleted the worktree-tanstack-table branch July 11, 2026 22:32

This branch was previously deployed

1 inactive deployment
Preview — 0a35609e Deployed Jul 11, 2026 by vercel[bot]
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