Repository navigation
feat(Table): window tables that use selection and row index - #10658
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.
Changes requested: selection and row-index windowing works in balanced density, but three issues need fixing first.
- The windowed
#column width now depends on the row count and on whether the table is windowed (useTableRowIndex.tsx:120-127, asserted by the new 56px/48px test), whichcomponent:TableFR13, PR3 and DEC-2 rule out ("virtualization … cannot change any floor"), so keep one width that depends on neither or have an engineering owner amend FR13/DEC-2 for row-number columns first. - With
density="spacious", a windowed table with row numbers falls back to full rendering when the reader scrolls into four-digit rows and the view jumps back to row 1, becausegetWindowedIndexWidthassumes the balanced 24px cell padding (useTableRowIndex.tsx:49-57). - The title, body and commit message say sticky-column and context-menu tables fell back and that the count-independence marks stop re-renders, but on the base both kinds of table already stay windowed, appending already re-renders only the new row, and the four
TableMenuWindowFocustests pass without this change, so retitle to selection and row index and either add a menu test that fails on the base or narrow that claim.
Two comment rewrites are suggested inline; they are not blocking.
[Automated review]
3814d1b to
a69b76a
Compare
a9cf951 to
a511885
Compare
There was a problem hiding this comment.
Changes requested: tables that use selection and row numbers now stay windowed, and spacious tables no longer fall back mid-scroll, but two issues remain.
- The windowed
#column is now widened from a measurement of the last row number (48 px unwindowed, 54 px windowed in balanced density and 62 px in spacious at 2,000 rows), whichcomponent:TableFR13, PR3 and DEC-2 rule out ("virtualization … cannot change any floor", resolution "without DOM measurement"), so keep one width that depends on neither windowing nor the row count, or have an engineering owner amend FR13, PR3 and DEC-2 for row-number columns first. - The title and body still say sticky-column and context-menu tables fell back and that the count-independence marks stop re-renders, and they cite a 56 px test that is no longer in this pull request, but on the base sticky-column and menu tables already stay windowed and re-render counts are unchanged, so retitle to "window tables that use selection and row index" and update the body to match the commit message.
[Automated review]
a511885 to
f700397
Compare
a69b76a to
075e4f5
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and two description fixes are needed.
- Spec decision: the windowed
#column is widened to fit its last number (48px unwindowed, 54px windowed in balanced and 62px in spacious density at 2,000 rows), whichcomponent:TableFR13, PR3 and DEC-2 rule out today ("virtualization … do not change any floor", floors resolve "without DOM measurement"), so this pull request depends on the exception proposed in #10666, and an engineering owner needs to decide that amendment, approving it by commenting/approve-spec <full head SHA>on #10666 (the author may do so as an engineering owner). - The body and commit message say the tests pin that sticky-column tables stay windowed, but the only fixture in
TableMenuWindowFocus.test.tsxuses a custom menu plugin and no sticky columns, so add auseTableStickyColumnscase or say the tests pin context-menu tables. - The body and commit message say that declaring the tree, grouped-row and expansion row models makes the full-render fallback say why, but the warning is the same string as before ("structural body modifiers must declare rowModel: 'flat' to admit windowing"), so describe what actually changes (plugins reading the render context see the declared model) or drop that clause.
Selection and row-index windowing otherwise works as described, and the new row-index tests cover it.
[Automated review]
f700397 to
9c78fe1
Compare
075e4f5 to
7b864de
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and one description fix is needed.
- Spec decision: in a windowed table the
#column is widened to fit its last number (48px unwindowed, 55px windowed in balanced and 63px in spacious density at 2,000 rows), whichcomponent:TableFR13, PR3 and DEC-2 rule out today ("virtualization … do not change any floor", floors resolve "without DOM measurement … extra render passes, or dependence on row values"), so this pull request depends on the exception proposed in #10666, and an engineering owner needs to decide that amendment by commenting/approve-spec <full head SHA>on #10666 (the author may do so as an engineering owner). - The body says "Sticky-column and context-menu tables already stay windowed on the base; this PR adds tests that pin that", but no test here windows a sticky-column table (the only windowed fixture in
TableMenuWindowFocus.test.tsxhas no sticky columns, and the new sticky test renders withoutvirtualization), so say the tests pin context-menu tables or add a windoweduseTableStickyColumnscase.
Selection and row-index windowing otherwise works as described, and the pinned columns now start where the widened # column ends. Two small comment suggestions are inline.
[Automated review]
| // Fixed layout sizes columns from the header, so rows keep their columns; | ||
| // pinned offsets read the extra width from a table variable. |
There was a problem hiding this comment.
Non-blocking (INV29): this sentence packs two topics. Suggested: "Fixed layout sizes columns from the header. Pinned offsets read the extra width from a table variable."
| } | ||
| const spacing = | ||
| style.letterSpacing === 'normal' ? 0 : readPixels(style.letterSpacing); | ||
| // Padding and borders between the text and the column edge. |
There was a problem hiding this comment.
Non-blocking (INV29): the comment restates the loop below it. Renaming chrome to paddingAndBorders says the same thing, and the comment can go.
There was a problem hiding this comment.
Changes requested: one description fix remains; the spec question is settled.
- The body says "Sticky-column and context-menu tables already stay windowed on the base; this PR adds tests that pin that", but no test here windows a sticky-column table (the only windowed fixture in
TableMenuWindowFocus.test.tsxhas no sticky columns, and the new sticky test renders withoutvirtualization), so say the tests pin context-menu tables or add a windoweduseTableStickyColumnscase.
The windowed # width now follows component:Table FR13, PR3 and DEC-2 as amended by #10666, and in Chromium it re-measured on a 999-to-1,000 append, a density switch and a host-inset change without clipping or falling back. The two earlier non-blocking comment suggestions stay open inline.
[Automated review]
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 description now matches the tests, which pin context-menu tables only; that was the last blocking item. The windowed # width follows component:Table FR13, PR3 and DEC-2 as amended by #10666: in Chromium, a 2,000-row table with selection, row numbers and a pinned column stays windowed at row 1,500 with the # column at 54px (balanced) and 62px (spacious), and appending row 1,000 widens it from 48px to 54px without falling back. Two non-blocking comment suggestions stay open inline.
[Automated review]
bf45941 to
fa70042
Compare
Selection and row-index columns register as fixed-height, so tables that use them stay windowed. The row index renders windowed numbers from the Table logical position. A windowed table widens a row-number column to fit its last position: the controller measures it from the cell's computed font and padding with canvas text metrics, in its first layout pass and after row-count or layout changes, and Table applies it to the header, so rows keep their columns. Pinned columns after a row-number column add its extra width through a table variable. Selection, sticky columns and tree data skip row-context tracking, which they never read; tree, grouped-row and row-expansion plugins declare their row models, which plugins reading the render context see. This diff was generated with AI assistance (Navi). Tags: ai-generated
56046e1 to
6ea613c
Compare
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head.
Tables that use selection or row numbers now stay windowed, and the windowed # column widens to fit its last number under the component:Table FR13 exception that #10666 added. In Chromium, a 2,000-row table with checkboxes, row numbers and a pinned column mounts 16 to 21 rows at row 1,500, every number fits, and the pinned column stays flush with the columns before it; the Table tests, typecheck, lint and the Changeset check pass.
Two optional comment tweaks remain open in BaseTable.tsx and useTableWindow.ts.
[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).
User need
Large tables usually also use selection and row numbers. Without this PR, a windowed table that uses either falls back to full rendering. Context-menu tables already stay windowed on the base; this PR adds tests that pin that.
Problem and solution fit
Each plugin that changes how a row renders now tells Table how it composes with fixed-height windowing, instead of Table guessing:
[feat]Changeset (table-windowing-selection-row-index) names@astryxdesign/core.Current specification
module:Table/useTableRowsVirtualizationFR9 (supported compositions: selection, sort and filter controls, sticky columns, context menus, row index).component:TableFR13/DEC-2 as amended by docs(specs): windowed Table row-number columns fit their last logical position #10666 (windowed row-number floor).Public delta and caller burden
No new API. A windowed table that uses selection or row numbers now stays windowed. Callers do nothing new.
Design and alternatives
Plugins register through the existing private column-admission and row-context protocols. A public "fixed height" assertion prop on columns was rejected: it would let callers admit content that Table cannot verify. A row-number width computed from the digit count and a fixed padding was rejected: padding and the code font come from theme tokens and density, so it clipped at spacious density. A hidden DOM probe was rejected: it wrote to the DOM and forced layout on every layout invalidation.
Evidence
tableColumnAdmissiontests: the same columns when no width is measured or every width fits, and a widened column otherwise.calc(48px + var(--_table-logical-extra-0, 0px)), and an unwindowed table sets no variable.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 Table, hooks, utils and Chat 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>: 920 authored lines.main, that is, after the PRs below it merge.This PR was generated with AI assistance (Navi).