Repository navigation
feat(Table): useTableRowsVirtualization's viewportHeight becomes initialViewportHeight, which no longer sizes the Table - #10894
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.
Approval waits on an engineering owner's decision on the module:Table/useTableRowsVirtualization record change, and three fixes are needed whatever that decision is.
This pull request intentionally rewrites FR10 and the required viewportHeight Geometry row of that current record. An engineering owner records the decision by commenting /approve-spec <full head SHA>, and the author may do so as an engineering owner. The decision to settle is whether initialViewportHeight keeps fixing the viewport's height after the first frame, as this head does, or is read for the first frame only, as the draft architecture:list-windowing DEC-6 in #10796 says.
Required changes:
- With
initialViewportHeightomitted and a parent that has no height, the scroll wrapper'sheight: 100%resolves to auto, so in Chromium all 2,000 of 2,000 rows mount while the Table stays windowed and no development diagnostic runs (Table.tsx:135-138); please detect that unbounded viewport, fall back with a diagnostic, and add a browser test. - The
initialViewportHeightJSDoc says the value is for the first frame and that the measured viewport wins after mount, butTable.tsx:266-267keeps the viewport'sheightandmax-heightat that value, so please align the JSDoc, or the behaviour, with the owner's decision. UseTableRowsVirtualizationConfig.viewportHeight(removed) andUseTableRowsVirtualizationConfig.initialViewportHeight(added) are outside this pull request's scope (Table): name them in the scope with aComponents:line under## Scopeand get an owner decision, or split them into their own pull request.
A declared height renders exactly as before in Storybook, and the Table tests, typecheck and lint pass.
[Automated review]
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableBody | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
8 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableRow | 7.0 kB (0) · 4.0 kB CSS (0) | — | ✓ · ✓ · ✗ |
| Table | 125.7 kB (+52 B) · 18.4 kB CSS (+79 B) | — | ✓ · ✓ · — |
| Markdown | 188.5 kB (+46 B) · 20.7 kB CSS (+82 B) | — | — · — · — |
| lab/CommentThread | 345.3 kB (+45 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 352.3 kB (+40 B) · 2.5 kB CSS (0) | — | — · — · — |
| TableCell | 110.3 kB (0) · 17.9 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TableHeaderCell | 109.9 kB (0) · 17.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TableSelectionToolbar | 70.7 kB (0) · 13.2 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size:
- @astryxdesign/cli 3.54 MB packed (+173 B); no new dependencies
- @astryxdesign/core 7.23 MB packed (+602 B); no new dependencies
API changes: core +1 · ~0 · −1
Committed API report behind this build: cli 29 rows, core 36 rows; run pnpm api:report.
2 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | core |
. · Types · interface UseTableRowsVirtualizationConfig |
initialViewportHeight: number |
import type {UseTableRowsVirtualizationConfig} from '@astryxdesign/core'; const x: UseTableRowsVirtualizationConfig = {initialViewportHeight: …} |
| − | core |
. · Types · interface UseTableRowsVirtualizationConfig |
viewportHeight: number |
import type {UseTableRowsVirtualizationConfig} from '@astryxdesign/core'; const x: UseTableRowsVirtualizationConfig = {viewportHeight: …} |
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the module:Table/useTableRowsVirtualization record change, and two fixes are needed whatever that decision is.
This pull request intentionally rewrites FR10, the Geometry row, the Builder impact and the Public contract of that current record, so that initialViewportHeight only seeds the first window and the Table takes its height from its parent. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Required changes:
component:TableFR19 still says windowing has "a bounded block size", but under a parent with no height this head keeps the Table windowed at its full content height (112,038px for 2,000 rows in Chromium), so please amend FR19 in this pull request or take the full-render fallback in that state.UseTableRowsVirtualizationConfig.viewportHeightandUseTableRowsVirtualizationConfig.initialViewportHeight(UseTableRowsVirtualizationConfig) are outside this pull request's scope (Table): name them in the scope and get an owner decision, or split them into their own pull request.
The earlier JSDoc mismatch is fixed, a parent with no height now gets one development warning, and the windowing story renders exactly as before; the docs should also say that the Table fills its parent's whole height, so a heading beside it overflows the parent.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI's lint, typecheck and test jobs have not run on this head yet.
An engineering owner approved the rewritten module:Table/useTableRowsVirtualization record and component:Table FR19 at this head, and the earlier FR19 and scope findings are fixed. The new tests fail on main and pass here, and in Chromium a windowed Table fills its sized parent, fits beside a heading in a flex column, and renders every row under an unsized parent.
- Miss: (non-blocking) the "no height limit" warning fires only when the table has more rows than the first window (
useTableWindow.ts:284), while FR19 and the module record say every unsized parent gets it, so please align that wording or drop the row-count condition.
[Automated review]
|
/approve-spec 33be261 |
There was a problem hiding this comment.
Approved pending CI: CI's lint, typecheck and test jobs were skipped at this head and have not run on it yet.
An engineering owner approved the rewritten module:Table/useTableRowsVirtualization record and component:Table FR19 at this head. The earlier finding is fixed: as a sized Card's only child, the windowed scroll region now reaches the Card's bottom edge and takes its corner, and the new Chromium spec covers it.
Non-blocking: a parent with no height mounts every row without a development message; the runtime context still carries the first-frame seed as viewportHeight; and one comment in Table.tsx could be split into shorter sentences.
[Automated review]
| // A windowed table scrolls inside the height its parent gives it. As its | ||
| // container's first or last child, the region bleeds over that block edge's | ||
| // padding (containerBleed), so its height adds that padding back and it | ||
| // ends at the same edge. |
There was a problem hiding this comment.
Non-blocking (INV29): the second sentence runs to about 30 words and joins two topics, the bleed and the height add-back. Suggested:
// A windowed table fills the height its parent gives it. As a first or last
// child, the region bleeds over that edge's padding (containerBleed). Its
// height adds that padding back, so it ends at the edge.…optional initialViewportHeight Renamed before the hook's first stable release, per the virtualizer vocabulary decision. initialViewportHeight sizes the first frame, on the server and before the viewport is measured, and bounds the viewport; after mount the measured viewport sets the window, as it already did. Without it, the Table's scroll wrapper fills its block-sized parent and the first frame seeds one row plus overscan. A non-positive or non-finite value falls back to full rendering. rowHeight is unchanged. The module record, docs, CLI example, story, api-report and Changesets follow. New tests seed from the initial height, window without it (server and client agree on one row plus overscan, and the viewport fills its parent), and fall back for a zero height; they fail on main. Co-authored-by: Humberto Virtudes <[email protected]>
…able takes its height from its parent Per the owner's ruling that the height has one way to be set: initialViewportHeight sizes no element. It only seeds the first window, on the server and before the viewport is measured. A windowed Table's scroll area fills its block-sized parent, so the parent's height bounds it. A scroll area as tall as its content, holding more rows than the first window, has no height limit: every row renders and one development warning says how to size the parent. The story and the CLI example put the Table in a 320px-tall stack. The docs, the module record and the Changeset describe the sized-parent pattern. Tests: the prop sizes nothing, a bounded parent windows with no warning, and an unbounded parent renders every row with one warning; the last two fail on the previous head. Co-authored-by: Humberto Virtudes <[email protected]>
component:Table FR19 now says the windowed viewport's block size is the height its parent gives it, and that a parent giving none leaves every row rendered with one development diagnostic. The height-limit reading starts at false, so a bounded first reading sets no state. isScrollAreaUnbounded moves above getGeometryViolation's doc block. The hook docs say the Table fills the parent's whole height: make it the parent's only child, or a flex child with min-height: 0 beside a heading or toolbar.
…the rename and the Table's height Per the owner: initialViewportHeight is a required number, as viewportHeight was, and the change is only the rename plus the Table no longer sizing its scroll area from it. The optional handling, its one-row seed fallback, the unbounded-parent detector and its development warning are removed. The windowed scroll area takes height: 100% and min-height: 0 from its parent. One test pins the parent-height behavior: with a sized parent the Table windows; with a parent that gives no height, the scroll area is as tall as its content and every row renders. FR19 says the block size is the height the parent gives; the module record says initialViewportHeight seeds only the first window.
…m edge; docs name the parent height As its container's first or last child, the windowed scroll region bleeds over that block edge's padding. Its height: 100% resolved against the container's content box, so in a 400px Card it ended 24px above the Card's bottom while it took the bottom corner. The height now adds the bled padding back on the edges where the bleed applies, so the region ends at the edge whose corner it takes. A story puts the windowed Table in a 400px Card, and a Chromium proof checks that the region's inset from the Card is the same at the top and the bottom and that it still windows. The hook docs, the Table docs and the CLI example say: give the Table's parent a height, fixed or relative, or a flex child, so windowing can bound the rows; with no height every row renders. The module record states the principle once: the hook reads the measured height of the Table's scroll area and never defines it. Co-authored-by: Humberto Virtudes <[email protected]>
8e024ad to
77113f0
Compare
|
/approve-spec 77113f0 |
There was a problem hiding this comment.
Approved pending CI: CI's unit, interaction and accessibility browser jobs are still running on this head, so this is not yet ready to merge.
An engineering owner approved the rewritten module:Table/useTableRowsVirtualization record and component:Table FR19 at this head. The rename and the parent-height rule match them, and in a sized Card the windowed scroll region reaches both block edges and takes the Card's corners.
Non-blocking:
- A parent with no height mounts every row with no development message (2,000 rows in a 112,038px region in Chromium), so a missed parent height goes unnoticed until the table is large.
- The runtime context still carries the first-frame seed as
viewportHeight, whichTable.tsxonly tests for!= null; a boolean name would stop it reading as a size. - The comment at
Table.tsx:134-137could be split into shorter sentences.
[Automated review]
There was a problem hiding this comment.
Changes requested: one fix is needed before this can be approved.
- Found by CI:
packages/core/src/theme/derivedVarRegistry.test.ts:473fails at this head becauseTable.tsxadds the private custom properties--_table-bleed-block-startand--_table-bleed-block-endwithout registering them, so list them in that test'sPRIVATE_SYSTEM_VARSwith the record that requires them (as the List corner variables are), or write the first- and last-child height without new custom properties.
An engineering owner approved the rewritten module:Table/useTableRowsVirtualization record and component:Table FR19 at this head, and the rename and the parent-height rule match them; in a sized Card the scroll region now reaches both block edges and takes the Card's corners.
Non-blocking: a parent with no height mounts every row with no development message; the runtime context still carries the first-frame seed as viewportHeight; and the comment at Table.tsx:134-137 could be split into shorter sentences.
[Automated review]
|
/approve-spec 5e07e04 |
There was a problem hiding this comment.
Approved pending CI: CI's heavy test suites are deferred on this head and run in the pre-merge re-run.
An engineering owner approved the rewritten module:Table/useTableRowsVirtualization record and component:Table FR19 at this head, and the two private bleed variables are now registered, so the theming-surface test that failed before passes. In Chromium the windowed region fills a 400px Card and ends at its edge, and it shrinks to the space left under a toolbar in a flex column.
Non-blocking suggestions:
- A Table under a parent with no height mounts every row with no development message; the docs say so, but nothing tells a caller at runtime.
- The runtime context still names the first-frame seed
viewportHeight(BaseTable.tsx:1064), the same word the module uses for the measured height; a boolean such ashasBlockViewportwould say what the wrapper uses. - The comment at
Table.tsx:134-137has a 30-word sentence that joins the bleed and the height add-back; split it.
[Automated review]
Main renamed the hook's viewportHeight to initialViewportHeight (#10894). The Table adapter keeps the shared engine and maps the first-frame height into the engine's pitch; the module record keeps main's Geometry row and this branch's list-windowing owners.
(A) merged main, which renamed the hook's viewportHeight to initialViewportHeight (#10894). Admission and the windowed runtime in the plugin read the new name; BaseTable keeps this branch's Window boundary.
|
Post-merge notes from the virtualization side, thanks for taking this! (it merged before I got to approve) Two follow-ups Id like, happy to take both:
Nits: the runtime context still calls the flag viewportHeight and memoizes on the seed, a boolean (isBlockViewport) reads better. initialViewportHeight stays required while the vocabulary card says optional, fine by me since relaxing it later is additive, just worth a line in the record so they agree. |
…irst consumer (#10810) * refactor(core): one shared list-windowing engine, with Table as its first consumer Moves utils/listWindow.ts to packages/core/src/virtualization/ and lifts the generic parts of Table's window controller into it: useListWindow (geometry subscription, first-visible-key anchoring across data and pitch changes, the pending-anchor scroll, the one retained focus island and focus return) and the canvas measurement helpers. Table keeps its admission, logical-position column widths and mounted-row diagnostics, and calls the shared hook. The geometry snapshot's bodyOffset is named startOffset. Lab reaches the module only through Core's private @astryxdesign/core/internal/virtualization entry. No behavior or public API change. Co-authored-by: Humberto Virtudes <[email protected]> * Merge remote-tracking branch 'origin/main' into refactor/shared-virtualization-engine * Merge main into refactor/shared-virtualization-engine Main renamed the hook's viewportHeight to initialViewportHeight (#10894). The Table adapter keeps the shared engine and maps the first-frame height into the engine's pitch; the module record keeps main's Geometry row and this branch's list-windowing owners. * chore: the shared-identity baseline and the list-windowing record name the shared module The canvas cache textContext moved with the text measurement into packages/core/src/virtualization/measure.ts, so the shared-identity baseline key follows it with its memo-cache reason. architecture:list-windowing now routes packages/core/src/virtualization/ and its private entry, names them as the module, and says Table uses it while Selector and Chat render every item. No source change. * Merge branch 'main' into refactor/shared-virtualization-engine
Builder impact
useTableRowsVirtualization({rowHeight, viewportHeight})becomesuseTableRowsVirtualization({rowHeight, initialViewportHeight}). Both stay required. The hook has shipped only in canary builds (the latest stable Core, 0.7.11, doesn't have it), so it's renamed before its first stable release, with no alias.Behavior
initialViewportHeightonly seeds the first window, on the server and in the first client frame (ceil(initialViewportHeight / rowHeight) + 4rows). After mount the measured viewport sets the window, as before.height/maxHeightfrom the prop. It takesheight: 100%; min-height: 0, so a fixed-height parent, or a flex child withmin-height: 0, bounds it.rowHeightand the validation are unchanged.Records and docs
module:Table/useTableRowsVirtualization: the public contract, builder impact, Geometry concept, the API section and FR10's seed formula useinitialViewportHeight, which seeds only the first window. The owner row comes from Specs.component:TableFR19: the block size is the height the parent gives..doc.mjs), the CLI example block, the Storybook story,api-report.md, and the original feature Changeset now use the new name. The example and the story put the Table in a 320px-tall stack. A new Changeset records the rename and the sizing rule.Evidence
TableWindowedCard.a11y.chromium.spec.ts: in a 400px Card, the region's inset is the same at the top and bottom, and it still windows.useTableRowsVirtualization.test.tsx:initialViewportHeight: 240seeds 9 rows and sets no height on the scroll area, which takesheight: 100%.initialViewportHeight: 0falls back to rendering every row.sharedBrandspass, along with coretsc, ESLint, Prettier,check:changesetsandcheck:knowledge. The heavy legacy render-cost test times out under full-suite load on a laptop and passes alone.Credit: the Table virtualization stack, its window controller and the list-windowing module are Humberto Virtudes's (@humbertovirtudes). This changes only the hook's viewport input. The final design here (a required
initialViewportHeightthat only seeds the first window, the Table's height from its parent's layout, and no warning) differs from his original, in whichviewportHeightalso set the scroll area's height.Scope
Components: Table, UseTableRowsVirtualizationConfig
Writing rubric results
module:Table/useTableRowsVirtualization.