Skip to content

feat(core): add the shared list-windowing module and Table's capability hook - #10656

Merged
humbertovirtudes merged 1 commit into
mainfrom
table-virt/3-window-planner
Nov 8, 2026
Merged

humbertovirtudes merged 1 commit into
mainfrom
table-virt/3-window-planner

Conversation

@humbertovirtudes

@humbertovirtudes humbertovirtudes commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Stack

Row virtualization is split into eight stacked PRs, each under the 2,000-line limit. Each PR's base is the one above it, so review and merge from the top of this list down.

  1. perf(Table): build the row-index column once per plugin #10654 perf(Table): build the row-index column once per plugin
  2. refactor(core): share per-instance warning dedupe and temporary focus targets #10655 refactor(core): share per-instance warning dedupe and temporary focus targets
  3. feat(core): add the shared list-windowing module and Table's capability hook #10656 feat(core): add the shared list-windowing module and Table's capability hook (this PR)
  4. feat(Table): add the window controller and Table's shared-geometry runtime #10657 feat(Table): add the window controller and Table's shared-geometry runtime
  5. feat(Table): window fixed-height flat tables through useTableRowsVirtualization #8280 feat(Table): window fixed-height flat tables through useTableRowsVirtualization
  6. feat(Table): window tables that use selection and row index #10658 feat(Table): window tables that use selection and row index
  7. perf(Text): take a new text's first truncation measurement from the shared observer #10668 perf(Text): take a new text's first truncation measurement from the shared observer
  8. test(Table): add Chromium accessibility and 1k/10k/100k release evidence for row windowing #10659 test(Table): add Chromium accessibility and 1k/10k/100k release evidence for row windowing

Two record amendments the stack relies on: #10665 (Table adopts the shared list-windowing module first) and #10666 (a windowed row-number column fits its last position).

Maintainer impact

Fixed-height row windowing needs a planner that is small enough to review on its own: which rows to mount for a scroll position, the spacer heights around them, and where to keep the visible row when data changes. The list-windowing architecture record (INV1) requires that arithmetic to live in one shared private module in Core, so Selector and Chat can adopt the same planner later.

Intended invariant

  • One owner for windowing arithmetic: packages/core/src/utils/listWindow.ts. It is list-neutral and is not exported from the package.
  • Range planning is pure arithmetic over declared pitch, viewport height, scroll position, content offset and row count. It has no DOM reads, no variable-size cache and no per-scroll data scan.

Change

  • utils/listWindow.ts: the range, gap and anchor calculation (calculateListWindow, createListWindowSegments, reconcileListAnchor), with four overscan rows per side and one optional focused-row island. startOffset is the distance from the scroll origin to the first row, such as a table header. A scroll position inside that leading content plans the first rows and keeps its offset after rows change, including when no old key survives; a position inside the rows then moves to the first row.
  • Table/plugins/virtualization/useTableRowsVirtualization.ts: the hook that returns an opaque, frozen geometry capability for {rowHeight, viewportHeight}.
  • Nothing is exported from the package yet, and Table does not use either file until later in this stack.
  • A [chore] Internal Changeset names @astryxdesign/core.
  • docs(specs): Table row virtualization adopts the shared list-windowing module first #10665 amends the list-windowing record so Table's row virtualization adopts the module first, before Selector.

Evidence

  • Unit tests cover empty, short, first, middle and end ranges, fractional pitch, the focus island, gap counts and anchor reconciliation after inserts, removals and reorders.
  • New cases: a scroll inside the leading content plans the first rows with a negative offset; that offset survives a row change and a full replacement with new keys; a predecessor anchor keeps its fraction; a larger scrollHeight raises the scroll clamp and an invalid one is rejected; trailingContentHeight raises the anchor clamp; a supplied keyIndices map is used.
  • A capability test covers identity and immutability.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Format (Prettier), strict lint (--max-warnings=0) on every changed file, and pnpm typecheck in packages/core pass on this exact head.
  • vitest run --project ui packages/core at the top of this stack: 20,720 tests pass. The list-windowing and virtualization suites pass on this PR's own head. Four locale time-format tests (DateTimeInput, TimeInput, timeFormat) fail on the local machine's ICU data and pass in CI; they do not touch Table.
  • node scripts/pre-review.mjs --base <the branch below>: 669 authored lines.
  • CI runs on this PR once it targets main, that is, after the PRs below it merge.

This PR was generated with AI assistance (Navi).

@vercel

vercel Bot commented Nov 8, 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 8, 2026 6:52pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 7:03 PM UTC

@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 for the two blocking findings below.

  • tableWindow.ts adds a Table-owned range, overscan and gap planner, but the current architecture:list-windowing record (INV1, INV3) puts Core's list windowing in one shared private module that Table calls, so please move this arithmetic into that module with list-neutral names (its DEC-1 lists Selector as the first adopter, so an engineering owner may need to amend that order if Table adopts it first).
  • calculateTableWindow reports offset 0 for any scroll position above the first row (tableWindow.ts:97), so reconcileTableAnchor returns bodyOffset for scroll positions 0 to bodyOffset and, once wired, a data change at the top of a table scrolls the header out of view; keep the negative offset above the body and add a test that position 0 with bodyOffset: 40 reconciles to 0 after an append.

Non-blocking: the predecessor case in tableWindow.test.ts:262 still passes with the predecessor fallback deleted; an extent with headroom, such as keys: ['z', 'a'] with viewportHeight: 1 (expecting 35), would make it catch that.

[Automated review]

@humbertovirtudes
humbertovirtudes force-pushed the table-virt/2-shared-helpers branch from f0103e8 to b50c5cb Compare November 8, 2026 09:55
@humbertovirtudes
humbertovirtudes force-pushed the table-virt/3-window-planner branch from 4f863ff to a200f42 Compare November 8, 2026 09:55
@humbertovirtudes humbertovirtudes changed the title feat(Table): add the fixed-height window planner and capability hook feat(core): add the shared list-windowing module and Table's capability hook Nov 8, 2026

@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 for one remaining blocking finding.

  • When no old key survives a data change, reconcileListAnchor returns startOffset (packages/core/src/utils/listWindow.ts:236-239), so with a 40 px header a scroll position of 0, 25 or 39 moves to 40 when every row is replaced by rows with new ids; using Math.min(0, Math.max(-startOffset, offset)) as the fraction in that case keeps those positions, still sends positions inside the rows to the first row, passes the existing tests, and needs one new test.

The planner now lives in the shared private module that architecture:list-windowing calls for, a header-visible position survives edits and appends, and the predecessor test catches its fallback. Non-blocking: the description still names tableWindow.ts and 631 lines, and scrollHeight, trailingContentHeight and keyIndices have no test yet.

[Automated review]

Comment thread packages/core/src/utils/listWindow.ts Resolved
Comment thread packages/core/src/utils/listWindow.ts Resolved

@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: CI has not run on this head yet, and it runs once this pull request targets main.

The earlier blocking finding is fixed: with no surviving key, a scroll position inside the leading content now stays, and a test pins it. Both new modules stay private, and every change matches the list-windowing and useTableRowsVirtualization records.

Non-blocking:

  • Miss: a scroll position past the last row, inside trailing content taller than the viewport, snaps back to the end of the rows on any data change (listWindow.ts:88, :102, :241); reporting listTop - (rowCount - 1) * rowHeight past the last row and letting the last key's fraction run to rowHeight + trailingContentHeight would keep it.
  • The comment at listWindow.ts:236-237 puts two topics in one sentence; splitting it in two keeps it within the comment style.
  • The description still reports 669 authored lines; this head has 716.

[Automated review]

Comment on lines +98 to +102
const offset = !isMeasured
? 0
: listTop < 0
? listTop
: bodyTop - firstVisibleIndex * rowHeight;

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.

Non-blocking: past the last row, bodyTop is clamped to the row extent (line 88), so this offset tops out at rowHeight, and reconcileListAnchor clamps the fraction to rowHeight too (line 241). With 10 rows of 20 px, a 100 px viewport and 200 px of trailing content, scroll positions 250 and 300 reconcile to 200 even with unchanged keys. Reporting listTop - (rowCount - 1) * rowHeight past the last row, and letting the last key's fraction run to rowHeight + trailingContentHeight, would keep them.

Comment on lines +236 to +237
// With no surviving key, a position inside the leading content stays where
// it is, and a position inside the rows moves to the first row.

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.

Non-blocking: this sentence carries two topics in 25 words. Shorter: // With no surviving key, a position inside the leading content stays. A position inside the rows moves to the first row.

@humbertovirtudes
humbertovirtudes force-pushed the table-virt/2-shared-helpers branch 2 times, most recently from 4ba4cc4 to cd4865a Compare November 8, 2026 17:40
…ty hook

utils/listWindow is the one private long-list windowing module in Core:
fixed-pitch range, gap and first-visible-key anchor calculation. Above
the first row it reports the negative distance to it, so an anchor keeps
a scroll position inside leading content such as a header. It is not
exported. useTableRowsVirtualization returns the opaque geometry
capability Table will accept; Table does not use either yet.

This diff was generated with AI assistance (Navi).
Tags: ai-generated
@humbertovirtudes
humbertovirtudes changed the base branch from table-virt/2-shared-helpers to main November 8, 2026 18:42

@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: CI passes on this head.

The planner is the one private list-windowing module the current records call for, and it computes what the Table virtualization record specifies; nothing is exported or wired into Table yet, and the added Changeset says exactly that.

Non-blocking, unchanged since the last review:

  • A scroll position inside trailing content taller than the viewport moves back to the end of the rows on a data change (packages/core/src/utils/listWindow.ts:88, :241).
  • The comment at packages/core/src/utils/listWindow.ts:236-237 carries two topics in one sentence; splitting it into two sentences fixes it.
  • The description's Testing section still reports 669 authored lines; this head has 723.

[Automated review]

@humbertovirtudes
humbertovirtudes merged commit d0ab3cb into main Nov 8, 2026
75 checks passed
@github-actions
github-actions Bot deleted the table-virt/3-window-planner branch November 9, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 9303acd5 Deployed Nov 8, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant