Repository navigation
feat(core): add the shared list-windowing module and Table's capability hook - #10656
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Requesting changes for the two blocking findings below.
tableWindow.tsadds a Table-owned range, overscan and gap planner, but the currentarchitecture:list-windowingrecord (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).calculateTableWindowreports offset 0 for any scroll position above the first row (tableWindow.ts:97), soreconcileTableAnchorreturnsbodyOffsetfor scroll positions 0 tobodyOffsetand, 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 withbodyOffset: 40reconciles 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]
f0103e8 to
b50c5cb
Compare
4f863ff to
a200f42
Compare
There was a problem hiding this comment.
Requesting changes for one remaining blocking finding.
- When no old key survives a data change,
reconcileListAnchorreturnsstartOffset(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; usingMath.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]
a200f42 to
66c4304
Compare
b50c5cb to
5cad527
Compare
There was a problem hiding this comment.
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); reportinglistTop - (rowCount - 1) * rowHeightpast the last row and letting the last key's fraction run torowHeight + trailingContentHeightwould keep it. - The comment at
listWindow.ts:236-237puts 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]
| const offset = !isMeasured | ||
| ? 0 | ||
| : listTop < 0 | ||
| ? listTop | ||
| : bodyTop - firstVisibleIndex * rowHeight; |
There was a problem hiding this comment.
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.
| // 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. |
There was a problem hiding this comment.
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.
4ba4cc4 to
cd4865a
Compare
…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
66c4304 to
9303acd
Compare
There was a problem hiding this comment.
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-237carries 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]
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.
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
packages/core/src/utils/listWindow.ts. It is list-neutral and is not exported from the package.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.startOffsetis 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}.[chore] InternalChangeset names@astryxdesign/core.Evidence
scrollHeightraises the scroll clamp and an invalid one is rejected;trailingContentHeightraises the anchor clamp; a suppliedkeyIndicesmap is used.Scope
Testing
--max-warnings=0) on every changed file, andpnpm typecheckinpackages/corepass on this exact head.vitest run --project ui packages/coreat 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.main, that is, after the PRs below it merge.This PR was generated with AI assistance (Navi).