Repository navigation
fix(Table): a column-windowed scroll that keeps its columns renders the table once - #11826
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec b8839aa |
PR Analysis Report🔎 Preview ·
|
| 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.
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
There was a problem hiding this comment.
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
previousRangeinuseInlineListWindow.tsreads 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 unpinsc39at 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
mainand 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
mainand 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.
…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.
|
/approve-spec 9560509 |
There was a problem hiding this comment.
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
mainand 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
mainwith 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
mainon 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.
|
/approve-spec e63f353 |
There was a problem hiding this comment.
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
mainand 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
mainwith 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.
|
/approve-spec 8f8c680 |
There was a problem hiding this comment.
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-131and: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
mainwith 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.
…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






User impact
useTableColumnsVirtualization), such as a 300-column report.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
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 onmainwith 2 render passes for one scroll, and passes here with 1. It counts render passes, not commits.mainback to back, 300 range and 120 no-op steps per run):module:Table/useTableColumnsVirtualizationPR3 at 1,000 columns × 20 rows, 1× CPU.mainmainThe 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.module:Table/useTableColumnsVirtualizationPR3: range ≤ 4 ms, no-op ≤ 2 ms). Setup: a local production Storybook build of a 1,000-column × 20-row column-windowed story, Chrome 149 headed, 1280 × 900, 1× CPU, dev-only instrumentation off, 300 range and 120 no-op steps per run. With fix(Table): when only its columns window, a scroll that keeps its columns commits nothing #11844, perf(Table): pinned offsets are computed once per column list, not once per cell #11893, perf(Text): a truncation measurement that finds the same result sets no state #11911 and perf(Table): a default cell measures its truncation on first hover or focus #11933 together: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 preflightat 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
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-onlyhold 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.