Skip to content

feat(bench): real TanStack Table comparator adapter - #122

Merged
blove merged 1 commit into
mainfrom
b2-tanstack
May 8, 2026
Merged

feat(bench): real TanStack Table comparator adapter#122
blove merged 1 commit into
mainfrom
b2-tanstack

Conversation

@blove

@blove blove commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of 4 for Tier 1 B2 comparative bench.

Replaces the placeholder tanstack-adapter.tsx (shipped in Phase 1) with a real TanStack Table v8 + @tanstack/react-virtual v3 implementation:

  • useReactTable + useVirtualizer per the official virtualized-rows example.
  • Headless rendering with grid-template-columns; sortable column headers via getToggleSortingHandler(); getSortedRowModel + getFilteredRowModel engaged.
  • Streaming updates via setData merge by id — TanStack has no transaction API; this is the honest fairness-asterisk baseline called out in the spec.
  • Cell renderers (scroll-with-format / -render / -heavy-render) wired through column-def cell: JSX.
  • Viewport / row / cell carry data-pretable-bench-tanstack-viewport, data-tanstack-row, data-tanstack-cell attrs matching the runtime profile selectors set in Phase 1, plus data-row-id / data-row-index for the runtime measurement helpers.

New deps in apps/bench only (@tanstack/react-table@^8, @tanstack/react-virtual@^3); zero leakage into @pretable/* public-surface packages.

Provisional resolution

The plan flagged keyboard-nav-row as a provisional cell for tanstack. Stock TanStack Table doesn't ship arrow-key cell navigation — adding it would require a custom keyboard handler, which is the kind of shim the spec explicitly forbids. The Slab 1 `validateSupportedP0aRequest` guard in `packages/bench-runner` already returns `unsupported` for non-pretable adapters on this script, matching the spec's documented unsupported matrix. Decision: ship as `unsupported` for tanstack — no adapter or app-shell changes required.

What's NOT in this PR

Note on the jsdom shim

The smoke test installs a minimal `ResizeObserver` stub plus `offsetWidth`/`offsetHeight` overrides scoped to elements with `data-pretable-bench-tanstack-viewport`. `@tanstack/react-virtual` reads those for size; jsdom returns 0 for both, and without the shim the virtualizer never emits virtual rows. The shim is per-attribute scoped (returns 0 for non-tanstack elements) and is documented inline in the test. Real-browser matrix runs in Phase 4 are unaffected.

Test plan

  • `pnpm -w typecheck` passes
  • `pnpm -w test` passes (incl. new `tanstack-adapter.test.tsx`)
  • `pnpm -w lint` 0 errors
  • `pnpm format` clean
  • `pnpm why @tanstack/react-table` against public packages — 0 occurrences

🤖 Generated with Claude Code

Phase 2 of 4 for B2 comparative bench. Replaces the Phase 1 placeholder
shell with a real TanStack Table v8 + @tanstack/react-virtual adapter:
useReactTable + useVirtualizer per the official virtualized-rows
example, headless rendering, getSortedRowModel + getFilteredRowModel,
setData merge for streaming updates (TanStack has no transaction API),
and JSX cell renderers wired to scroll-with-format/-render/-heavy-render
scripts. The viewport carries data-pretable-bench-tanstack-viewport,
data-tanstack-row, and data-tanstack-cell attributes that match the
runtime profile selectors set in Phase 1.

keyboard-nav-row resolves to unsupported under the
validateSupportedP0aRequest guard inherited from Slab 1
(packages/bench-runner/src/index.ts is locked for Phase 2). That
matches the spec's documented unsupported matrix and the cheapest-path
default in plan task 2.4.

New deps land in apps/bench only (@tanstack/react-table@^8,
@tanstack/react-virtual@^3); no leakage into @pretable/* public
packages (verified via pnpm why).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
pretable Ready Ready Preview, Comment May 8, 2026 11:55pm

@blove
blove enabled auto-merge (squash) May 8, 2026 23:53
@blove
blove merged commit aaeaa69 into main May 8, 2026
13 checks passed
@blove
blove deleted the b2-tanstack branch May 8, 2026 23:56
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Vercel preview ready

Preview: https://pretable-qz9pif2t5-cacheplane.vercel.app
Commit: 6a06fcdd07be97e6b7f4e9c919a5447b17b613b8

Updated automatically by the deploy-preview job.

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