Skip to content

fix(Table): a column-windowed scroll that keeps its columns renders the table once - #11826

Merged
cixzhang merged 4 commits into
mainfrom
l0/table-column-window-scroll-once
Nov 20, 2026
Merged

cixzhang merged 4 commits into
mainfrom
l0/table-column-window-scroll-once

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people scrolling a Table sideways when it uses column windowing (useTableColumnsVirtualization), such as a 300-column report.
  • Before: every horizontal scroll step rendered the column window twice within its one commit, even a step that kept the same columns mounted. The column window stored its last scroll position in React state during render, which made React run the render again at once.
  • After: each step renders the column window once within its commit. A scroll that keeps the same columns still commits once, because the shared scroll subscription reports every scroll position. That commit costs less.
  • Unchanged: which columns mount, the first-visible-column anchor when columns move, widen, hide or get pinned, focus retention, and RTL.

What changed

  • virtualization/useInlineListWindow.ts: the window's state holds only what a scroll does not change: the planned keys and offsets, the insets they were laid out between, the geometry source, and a pending anchor scroll. It updates only when one of those changes. When the items change, the anchor reads the first visible item and its fraction from the previous offsets, at the scroll position the window shows and between the previous insets, instead of from a value stored on every scroll.
  • [fix] changeset.

Evidence

  • Red first: useTableColumnsVirtualization.test.tsx "renders the column window once for a scroll inside the mounted range" counts the header-row transform, which runs once each time the column window renders the table. It fails on main with 2 render passes for one scroll, and passes here with 1. It counts render passes, not commits.
  • Unpinning near the end (FR8): "writes no scroll when the last column is unpinned near the end of the run" unpins the end-pinned last column at 3,450 px, within one column of the run's end. Without the previous insets, the anchor clamped the remembered scroll and wrote 3,400 px; here it writes nothing and the first visible column stays.
  • No regressions: the column-windowing, rows-and-columns, rows-windowing and list-window suites pass, 107 tests, including every FR8 anchor case (move to the end, widen, the anchor itself widening, hide, pin, unpin) and the RTL read.
  • Timing (real multi-process Chrome 149, same harness as the first report, head vs main back to back, 300 range and 120 no-op steps per run): module:Table/useTableColumnsVirtualization PR3 at 1,000 columns × 20 rows, 1× CPU.
Step Build React render p95 Scripting p95 (production) Commits per step
Range change main 4.0 ms 7.30 ms 3
Range change this head 3.2 ms 6.30 ms 3
No-op (same columns) main 1.0 ms 1.74 ms 1
No-op (same columns) this head 0.7 ms 1.40 ms 1

The render phase now meets the 4 ms line, and every step is cheaper. A no-op step still commits once, as on main. PR3's range-plus-commit (production scripting) is still above 4 ms here. This pull request is an improvement on its own and does not claim PR3; #11844, stacked on it, removes the no-op commit, and the remaining range-step cost is a separate follow-up.

Host Range p95, main Range p95, all four No-op p95, all four
First farm host 6.49–6.67 ms 3.43–3.50 ms 0.62–0.68 ms
Second farm host (about 18% slower) 7.59–8.03 ms 3.60–4.14 ms 0.72–0.99 ms
Release check's runner (4-core-ubuntu, timing gate on) — range-plus-commit p95 3.5 ms 0.1 ms

On both farm hosts the range step costs about half of main's, with one commit per range step (main: 3). On the release check's runner, which decides PR3, the four together meet it: range-plus-commit p95 3.5 ms (≤ 4) and no-op p95 0.1 ms (≤ 2), measured with the Table release proof's own scroll-to-commit probe in one gated run. The last of the four to land claims PR3.

Preflight

pnpm preflight at 8f8c680 (main ee65f4f merged), run on a separate build machine: review:pre, build, typecheck, lint, vitest ui, knowledge and changesets PASS. vitest node failed only .github/scripts/lib/offline-media.test.mjs's two real-browser cases, because that machine reaches the network through a proxy that holds an unreachable host open; re-run without the proxy, the file passes 24/24. No other failure.

Scope

  • One hook file and one test; no API or record change.
  • Public text contains no internal context.

Overlap checked: #11197 (a separate prototype of a scroll band on both axes, which the post-merge review recommended declining; this fix changes no part of its design)

The windowing-spec-only hold covers the windowing surfaces; an exemption is requested for this head.

Owner: Astryx fix-loop lane 0. Land path: timing re-measured on this head, CodeBunny approval of the exact head, Specs stamp, hold exemption, CI, then the merge queue.

…he table once

useInlineListWindow stored its last window in state on every scroll, so
each scroll rendered the column window twice. It now sets state only
when the items, the geometry source or a pending anchor change. The
anchor reads the first visible item from the previous offsets at the
scroll position the window shows, instead of tracking it per scroll.
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 20, 2026 3:13am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 15, 2026
@astracat-bot

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 20, 2026, 5:19 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b8839aa

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8f8c680

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Table 123.8 kB (0) · 21.1 kB CSS (0) — ✗ · ✓ · —
TableBody 6.6 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableCell 105.9 kB (0) · 20.1 kB CSS (0) — ✗ · ✓ · ✓
5 more components
Component Size LoC Visual · A11y · RTL
TableFooter 3.5 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableHeader 3.5 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableHeaderCell 105.8 kB (0) · 20.0 kB CSS (0) — ✗ · ✓ · ✓
TableRow 7.2 kB (0) · 4.1 kB CSS (0) — ✗ · ✓ · ✗
TableSelectionToolbar 77.7 kB (0) · 14.5 kB CSS (0) — ✗ · ✓ · ✓
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
Table · Default (neutral, dark) · inheritance unknown: not found in the 9 newest reports of other pull requests before frame after frame diff frame
Table · Default (neutral, light) · inheritance unknown: not found in the 9 newest reports of other pull requests before frame after frame diff frame

Inheritance checked against the 9 newest reports of other pull requests.

Package size: @astryxdesign/core 7.85 MB packed (+422 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the render-once fix works, but the rebuilt anchor moves the view when an end-pinned last column is unpinned near the end of the run.

  • Unpinning an end-pinned column that sits last in column order, while scrolled to the end or within one column of it, moves the view back by up to that column's width and changes the first visible column, which the column anchor rule (FR8) forbids, because previousRange in useInlineListWindow.ts reads the previous offsets with the post-change viewport size; please plan that range with the visible size the previous columns were laid out in, and add a test that unpins c39 at 3450px and expects no scroll write.

The new render-count test fails on main with 2 renders and passes here with 1, and a scroll that mounts new columns drops from 4 header-row renders to 2. Optional: the comments at lines 83-84 and 209-211 of useInlineListWindow.ts state the same invariant twice, so one line can cover it.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Release note: a horizontal scroll that keeps the same columns mounted renders the table once instead of twice. Verified: the new test gives 2 renders on main and 1 here.
  • Before this change, every scroll step rendered twice because the window stored its scroll position in state during render. Verified in the base hook and by the same test.
  • Scroll steps that mount new columns also skip the second render. Verified with a probe: 4 header-row renders become 2.
  • Which columns mount, the anchor when columns move, widen, hide or get pinned, focus retention and right-to-left stay unchanged. Verified for those cases by the existing tests and a pin probe; unpinning, which the list does not name, regresses (finding above).
  • The window state holds only keys, offsets, the geometry source and a pending anchor scroll, and updates only when one of them changes. Verified in the hook.
  • The anchor reads the first visible column from the previous offsets at the scroll position on screen. Verified as written; it uses the post-change viewport size, which causes the finding.
  • The new test fails on main and passes here. Verified.
  • The column, rows, table-window and list-window suites pass with 106 tests. Verified.
  • Timing measured on main, to be re-measured on this head. Not checked: nothing is claimed for this head.
  • Scope is one hook file and one test, with no API or record change. Verified; the release note is the third file, and no public API changes.
  • The public text holds no internal context. Verified.
  • The overlapping prototype pull request is a separate design. Verified: it is an open, not-for-merge measurement branch.
  • A hold exemption is requested. Not applicable: no repository record, label or review rule defines that hold.

Files:

  • .changeset/table-column-window-scroll-once.md: clear.
  • packages/core/src/Table/plugins/virtualization/useTableColumnsVirtualization.test.tsx: clear; it has no unpin case (see finding).
  • packages/core/src/virtualization/useInlineListWindow.ts: the anchor finding above, plus the optional comment cleanup.

Automated review (maintainer link)

…sible column

The anchor read the previous columns at the new visible size. Unpinning
an end-pinned last column widens the visible size in the same render, so
near the end of the run the remembered scroll was clamped back and the
view moved by up to that column's width. The window now remembers the
insets its columns were laid out between and plans the previous range
with them.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9560509

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. A horizontal scroll inside the mounted columns now renders the column window once (2 render passes on main, 1 here), the first-visible-column anchor keeps main's results, unpinning the last column at the end of the run included, and CI passes on this head. No blocking findings.

Claims and files checked

Review mode: same-head; reason: none

changed rules (0): none

Claims:

  • Release note: with column windowing, a horizontal scroll that keeps the same columns mounted renders the table once instead of twice. Verified: the new render-count test gives 2 passes on main and 1 here.
  • Who is affected: people scrolling a column-windowed Table sideways. Verified: the changed hook is reached only through Table's column windowing.
  • Before, every scroll step rendered the column window twice because the window stored its scroll position in state during render. Verified in the base hook and by the same test.
  • After, each step renders the column window once per commit, and a no-op step still commits once, at lower cost. Verified: a range step goes from 4 render passes to 2 with 3 commits on both, a no-op step commits once on both, and React time per step drops in Chromium.
  • Which columns mount, the anchor when columns move, widen, hide or get pinned, focus retention and right-to-left stay unchanged. Verified by the existing tests, which pass here and in CI, and by anchor probes that match main.
  • The window state holds only keys, offsets, insets, the geometry source and a pending anchor, and updates only when one of them changes. Verified in the hook (useInlineListWindow.ts:85-94, :227-243).
  • The anchor reads the previous first visible column and its fraction from the previous offsets, at the scroll position the window shows and between the previous insets. Verified (useInlineListWindow.ts:171-205).
  • A fix release note is included. Verified: a patch entry for the core package.
  • The render test fails on main with 2 passes and passes here with 1. Verified.
  • Unpinning the end-pinned last column at 3,450 px: the earlier anchor wrote 3,400 px, and now nothing is written. Verified: the test fails against the earlier anchor and passes here and in CI.
  • The column, rows-and-columns, rows and list-window suites pass, 107 tests. Verified: 107 passed; CI's UI tests also pass on this head.
  • Timing: this change is cheaper than main on range and no-op steps, with the same commit counts. Verified in direction in a Chromium development build; the production-build values are the author's measurement.
  • This change does not claim the scroll timing target. Consistent: nothing here claims it.
  • Combined timing with four other pull requests. Context about other pull requests, not a claim about this change.
  • Scope is one hook file and one test, with no API or record change. Verified: the release note is the third file, and the API reports list no changed rows.
  • The public text holds no internal context. Verified.
  • The overlapping prototype pull request is a separate design. Verified: it is an open, not-for-merge measurement draft.
  • A hold exemption is requested. Not applicable: no repository record, label or rule defines that hold.
  • The land path lists the remaining steps. A process statement, not a claim about the code.

Files:

  • .changeset/table-column-window-scroll-once.md: clear.
  • packages/core/src/Table/plugins/virtualization/useTableColumnsVirtualization.test.tsx: clear.
  • packages/core/src/virtualization/useInlineListWindow.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 04:56
@cixzhang
cixzhang marked this pull request as draft November 17, 2026 20:04
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e63f353

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the required checks are still running on this head. A horizontal scroll inside the mounted columns now renders the column window once (2 render passes on main, 1 here), and the first-visible-column anchor still holds, including when the end-pinned last column is unpinned near the end of the run and under right-to-left. No blocking findings.

Claims and files checked

Review mode: same-head; reason: none

changed rules (0): none

Claims:

  • Release note: with column windowing, a horizontal scroll that keeps the same columns mounted renders the table once instead of twice. Verified: the render-count test reads 2 on main and 1 here.
  • Who is affected: people scrolling a column-windowed Table sideways. Verified: only Table's column windowing uses the changed hook.
  • Before, every scroll step rendered the column window twice because the window stored its last scroll position in state during render. Verified in the base hook and by the same test.
  • After, each step renders the column window once within its commit, and a step that keeps its columns still commits once, at lower cost. Verified: a scroll sets no state, and commits per step are unchanged.
  • Which columns mount, the anchor when columns move, widen, hide or get pinned, focus retention and right-to-left stay unchanged. Verified by the column-windowing tests and the left-to-right and right-to-left browser specs on this head.
  • The window state holds only keys, offsets, insets, the geometry source and a pending anchor, and updates only when one of them changes. Verified (useInlineListWindow.ts:85-94, :227-243).
  • The anchor reads the previous first visible column and its fraction from the previous offsets, at the shown scroll position and between the previous insets. Verified (useInlineListWindow.ts:171-205).
  • A fix release note is included. Verified: a patch entry for the core package.
  • The render test fails on main with 2 passes and passes here with 1, and counts render passes, not commits. Verified on this head.
  • Unpinning the end-pinned last column at 3,450 px: the earlier anchor wrote 3,400 px, and now nothing is written. Verified: the test passes here and failed against the earlier anchor.
  • The column, rows-and-columns, rows and list-window suites pass, 107 tests. Verified on this head.
  • Timing: range and no-op steps are cheaper than on main, with the same commit counts. Verified in direction in a development build of the identical patch; the production numbers are the author's measurement.
  • This change does not claim the scroll timing target. Consistent: nothing here claims it.
  • Combined timing with four other pull requests, and which of them claims the target. Context about other pull requests, not a claim about this change.
  • Scope is one hook file and one test, with no API or record change. Verified: the release note is the third file, and the API comparison lists no changed rows.
  • The public text holds no internal context. Verified.
  • The overlapping prototype pull request is a separate design. Verified: it is an open prototype draft on another branch.
  • A hold exemption is requested. Not applicable: no repository record, label or rule defines that hold.
  • The land path lists the remaining steps. A process statement, not a claim about the code.

Files:

  • .changeset/table-column-window-scroll-once.md: clear.
  • packages/core/src/Table/plugins/virtualization/useTableColumnsVirtualization.test.tsx: clear.
  • packages/core/src/virtualization/useInlineListWindow.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 20, 2026 02:59
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8f8c680

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. A horizontal scroll inside the mounted columns now renders the column window once (2 render passes on main, 1 here), and the first-visible-column anchor still holds, including when the end-pinned last column is unpinned near the end of the run. CI passes on this head. No blocking findings.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim (release note): with column windowing, a horizontal scroll that keeps the same columns mounted renders the table once instead of twice: verified, the new render-count test fails on the base with 2 and passes here with 1.
  • Claim: on the base every scroll step rendered the column window twice because the window stored its last scroll position in state during render: verified, the base hook set its state whenever the scroll snapshot changed.
  • Claim: each step now renders the column window once, and a scroll that keeps the same columns still commits once through the shared scroll subscription: verified, useInlineListWindow.ts:127-131 and :220-243.
  • Claim: which columns mount, the anchor when columns move, widen, hide or get pinned, focus retention and right-to-left are unchanged: verified, the five windowing suites (107 tests) pass on this head.
  • Claim: the window's state holds only the planned keys and offsets, their insets, the geometry source and a pending anchor scroll, and updates only when one of those changes: verified, useInlineListWindow.ts:85-94, :220-243.
  • Claim: the anchor reads the first visible item and its fraction from the previous offsets, at the shown scroll position and between the previous insets: verified, useInlineListWindow.ts:169-205.
  • Claim: the render-count test counts the header-row transform and fails on main with 2 render passes, passing here with 1: verified, red-first run.
  • Claim: unpinning the end-pinned last column at 3,450 px wrote 3,400 px without the previous insets and writes nothing here: verified, the test fails against the pull request's first commit with 3,400 and passes here.
  • Claim: the column-windowing, rows-and-columns, rows-windowing and list-window suites pass, 107 tests, including every anchor case and the right-to-left read: verified on this head.
  • Claim: the timing tables, alone and combined with four other pull requests, including the release check's runner: the author's measurements, not reproduced; this pull request does not claim the timing target.
  • Claim: the author's preflight passed build, typecheck, lint, UI tests, knowledge and changesets, with two network-bound node tests failing only on that machine: the author's run, not reproduced; CI on this head passes build, typecheck, lint and every node and UI test shard.
  • Claim: one hook file and one test, no API or record change: verified, three files including the release note, and the API surface is unchanged.
  • Claim: public text carries no internal context: verified.
  • Claim: the overlapping prototype pull request is a separate design this fix does not change: verified, it is an open draft prototype that changes snapshot banding, which this pull request does not touch.
  • Claim: a hold exemption is requested: no current record or label defines that hold; left to maintainers.
  • File .changeset/table-column-window-scroll-once.md: clear.
  • File packages/core/src/Table/plugins/virtualization/useTableColumnsVirtualization.test.tsx: clear.
  • File packages/core/src/virtualization/useInlineListWindow.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 20, 2026 04:55
@cixzhang
cixzhang merged commit fc40575 into main Nov 20, 2026
157 checks passed
cixzhang added a commit that referenced this pull request Nov 20, 2026
#11826, this branch's base, landed as fc40575. The conflicts were that
squash against this branch's copy of the same commits; each file keeps
this branch's text (identical to before the merge).
@github-actions
github-actions Bot deleted the l0/table-column-window-scroll-once branch November 20, 2026 06:06
cixzhang added a commit that referenced this pull request Nov 21, 2026
…umns commits nothing (#11844)

* fix(Table): a column-windowed scroll that keeps its columns renders the table once

useInlineListWindow stored its last window in state on every scroll, so
each scroll rendered the column window twice. It now sets state only
when the items, the geometry source or a pending anchor change. The
anchor reads the first visible item from the previous offsets at the
scroll position the window shows, instead of tracking it per scroll.

* fix(Table): a column-windowed scroll that keeps its columns commits nothing

useInlineListWindow read the table geometry snapshot, which changes on
every scroll, so each scroll committed the column window even when no
column entered. It now reads through a selector that keeps the last
snapshot while the mounted range and viewport stay the same, and reads
every snapshot while an anchor scroll is pending, so it still sees the
scroll land.

* fix(Table): unpinning the last column near the end keeps the first visible column

The anchor read the previous columns at the new visible size. Unpinning
an end-pinned last column widens the visible size in the same render, so
near the end of the run the remembered scroll was clamped back and the
view moved by up to that column's width. The window now remembers the
insets its columns were laid out between and plans the previous range
with them.

* Merge remote-tracking branch 'origin/l0/table-column-window-scroll-once' into l0/table-column-window-no-op-scroll

* fix(Table): the no-op scroll note names columns-only windowing

A Table that also windows rows still commits once for such a scroll, so
the release note now names a Table that windows only its columns. The
selector also rebuilds when the item keys change, as its comment says.

* fix(Table): the column selector's comment names what rebuilds it

Keys are not a dependency of the range selector; Table rebuilds the
offsets whenever its column keys change, and the comment now says so.

* Merge branch 'main' into l0/table-column-window-no-op-scroll

#11826, this branch's base, landed as fc40575. The conflicts were that
squash against this branch's copy of the same commits; each file keeps
this branch's text (identical to before the merge).

* Merge branch 'main' into l0/table-column-window-no-op-scroll

* Merge branch 'main' into l0/table-column-window-no-op-scroll

This branch was successfully deployed

1 active deployment
Preview — 8f8c680a Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant