Repository navigation
feat(Table): useTableColumnsVirtualization windows the unpinned columns - #11014
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f4c490b to
74080eb
Compare
|
AI review status for this pull request.
|
5b9b26b to
110a653
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision. Two fixes are needed either way.
- Spec decision: column windowing,
useTableColumnsVirtualizationand theTable.virtualizationlist form are specified only in the open spec PR #11013 (module:Table/useTableColumnsVirtualizationand thecomponent:TableFR18 amendment), not onmain, so an engineering owner records the decision by commenting/approve-spec <full head SHA>on this pull request (the author may, as an engineering owner) or by landing #11013 first. - What the decision settles: whether this slice may ship before FR7 (focus retention), FR8 (inline anchor), FR10 (rows and columns together) and the PR3/PR4 timing evidence, and without a template example that names the new hook.
- Fix:
packages/core/src/Table/tableColumnAdmission.ts:80keeps the pinned-run registry in a module-localWeakMap, soscripts/shared-identity.test.mjsfails and a swizzled Table using the package'suseTableStickyColumnswindows its pinned column away; keep it undersharedWeakMap('table/table-column-admission/pinned-run-resolvers', 1)fromutils/sharedRealm. - Fix: the new
useTableColumnsVirtualization.doc.mjsadds the ShadCN routehooks/use-table-columns-virtualization, whichinternal/shadcn-registry/routes.lock.jsondoes not list, so the docsite build stops at the route-lock check (the failed Vercel deployment); commit the lock refreshed withUPDATE_SHADCN_ROUTE_LOCK=1 node apps/docsite/scripts/generate-data.mjs.
Tables without the capability render as before. In Chromium, the 300 × 200 story keeps the same visible cells while mounting 2,800 body cells instead of 60,000.
[Automated review]
| canWindow ? geometry.getSnapshot : getUnmeasured, | ||
| canWindow ? geometry.getServerSnapshot : getUnmeasured, | ||
| ); | ||
| // Prefix offsets of the windowed run, and the pinned run sizes. |
There was a problem hiding this comment.
Non-blocking (INV29): this comment restates the memo below it. Drop it and name the memo for what it holds, for example runGeometry.
74080eb to
e952229
Compare
110a653 to
fb3bd8b
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and three fixes are needed either way.
- Spec decision: column windowing,
useTableColumnsVirtualizationand theTable.virtualizationlist form are specified only in the open spec PR #11013 (module:Table/useTableColumnsVirtualizationand thecomponent:TableFR18 amendment), not onmain, so an engineering owner needs to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may, as an engineering owner) or by landing #11013 first. - What the decision settles: whether this slice may ship before FR7 (retained focused column), FR8 (inline anchor), FR10 (rows and columns together) and the PR3/PR4 timing evidence, and without a template block that names the new hook (INV28).
- Miss: a Table that first renders with
data={[]}never windows its columns once rows arrive, becausegetColumnViolation(useTableColumnWindow.ts:106-117) counts Table's own empty-state cell (<td colSpan={resolvedColumns.length}>,BaseTable.tsx:1127) as a spanning cell and latches the fallback for the unchanged widths and config, so ignore that row or skip the check while the body has no data rows. - Fix:
tableColumnAdmission.ts:80keeps the pinned-run registry in a module-localWeakMap, soscripts/shared-identity.test.mjsfails and a swizzled Table using the package'suseTableStickyColumnswindows its pinned column away; keep it undersharedWeakMap('table/table-column-admission/pinned-run-resolvers', 1)fromutils/sharedRealm. - Fix: the new
useTableColumnsVirtualization.doc.mjsadds the ShadCN routehooks/use-table-columns-virtualization, whichinternal/shadcn-registry/routes.lock.jsondoes not list, so the docsite build stops at the route-lock check; commit the lock refreshed withUPDATE_SHADCN_ROUTE_LOCK=1 node apps/docsite/scripts/generate-data.mjs.
The comment at useTableColumnWindow.ts:150 still restates the memo below it (a non-blocking INV29 note).
e952229 to
6217d0f
Compare
fb3bd8b to
5503e7f
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and three fixes are needed either way.
- Spec decision: column windowing,
useTableColumnsVirtualizationand theTable.virtualizationlist form are specified only in the open spec PR #11013 (module:Table/useTableColumnsVirtualizationand thecomponent:TableFR18 amendment), not onmain, so an engineering owner needs to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may, as an engineering owner) or by landing #11013 first. - What the decision settles: whether this slice may ship before FR7 (retained focused column), FR8 (inline anchor), FR10 (rows and columns together) and the PR3/PR4 timing evidence, and without a template block that names the new hook (INV28).
- Miss: a Table that first renders with
data={[]}never windows its columns once rows arrive, becausegetColumnViolation(useTableColumnWindow.ts:106-117) counts Table's own empty-state cell (<td colSpan={resolvedColumns.length}>,BaseTable.tsx:1127) as a spanning cell and latches the fallback for the unchanged widths and config, so ignore that row or skip the check while the body has no data rows. - Fix:
tableColumnAdmission.ts:80keeps the pinned-run registry in a module-localWeakMap, soscripts/shared-identity.test.mjsfails and a swizzled Table using the package'suseTableStickyColumnswindows its pinned column away; keep it undersharedWeakMap('table/table-column-admission/pinned-run-resolvers', 1)fromutils/sharedRealm. - Fix: the new
useTableColumnsVirtualization.doc.mjsadds the ShadCN routehooks/use-table-columns-virtualization, whichinternal/shadcn-registry/routes.lock.jsondoes not list, so the docsite build stops at the route-lock check; commit the lock refreshed withUPDATE_SHADCN_ROUTE_LOCK=1 node apps/docsite/scripts/generate-data.mjs.
The comment at useTableColumnWindow.ts:150 still restates the memo below it (a non-blocking INV29 note).
5503e7f to
5e442a7
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and two fixes are needed either way.
- Spec decision: column windowing,
useTableColumnsVirtualizationand theTable.virtualizationlist form are specified only in the open spec PR #11013 (module:Table/useTableColumnsVirtualizationand thecomponent:TableFR18 amendment), not onmain, so an engineering owner needs to record the decision by commenting/approve-spec <full head SHA>on this pull request (the author may, as an engineering owner) or by landing #11013 first. - What the decision settles: whether this slice may ship before the record's FR7 (retained focused column), FR8 (inline anchor), FR10 (rows and columns together) and PR3/PR4 timing evidence, and without a template block that names the new hook (
architecture:knowledge-contractsINV28). - Miss: a Table that first renders with
data={[]}never windows its columns once rows arrive, because its own empty-state row (<td colSpan>,BaseTable.tsx:1127) trips the spanning-cell check inuseTableColumnWindow.ts:106-117and latches the fallback; skip Table's empty-state row in that check, or skip the check while the body has no data rows. - The pinned-run registry at
tableColumnAdmission.ts:80is a module-localWeakMap, soscripts/shared-identity.test.mjsfails and a swizzled Table that uses the package'suseTableStickyColumnswindows its pinned columns away; keep it undersharedWeakMap('table/table-column-admission/pinned-run-resolvers', 1).
The ShadCN route-lock entry is now in place and the docs build passes. When this branch moves onto main, drop the packages/core/api-report.md hunk, since main no longer has that file.
6217d0f to
039e904
Compare
5e442a7 to
7a07c34
Compare
7a07c34 to
73e1552
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and two fixes are needed either way.
- Owner decision:
module:Table/useTableColumnsVirtualizationis now current, but it marks FR7 (retained focused column), FR8 (first-visible-column anchor), FR10 (rows and columns together) and the PR3/PR4 timing evidence "Required for release", andarchitecture:knowledge-contractsINV28 asks for a template block that names the new hook, so an engineering owner decides whether this slice ships first by commenting/approve-spec <full head SHA>on this pull request (the author may, as an engineering owner) or says the hook should wait. - Miss:
BaseTable.tsx:34-38statically importsuseTableColumnWindow, a crossing thatarchitecture:component-import-boundariesINV7 forbids, so the lint job's component-import-boundaries check fails and everyTableimport grows by 1.8 KB gzip; letuseTableColumnsVirtualizationregister or carry the planner so BaseTable reads only the registration, or get the record owner to approve an allowlist row. - Miss: a Table that first renders with
data={[]}never windows its columns once rows arrive, because Table's own empty-state cell (<td colSpan>,BaseTable.tsx:1127) trips the spanning-cell check inuseTableColumnWindow.ts:106-117and latches the fallback; skip that row in the check, or skip the check while the body has no data rows.
The pinned-run registry now uses a shared key, and the route-lock entry is in place. A non-blocking docs note is inline.
73e1552 to
f70735c
Compare
|
/approve-spec f70735c |
There was a problem hiding this comment.
Column windowing follows the current Table and module records for what this slice builds, and CI's real-browser run at this head confirms bounded, aligned columns; two wording fixes are needed before approval.
packages/core/src/Table/useTableColumnsVirtualization.doc.mjsdoes not say that focus in an unpinned column is lost when that column scrolls out (module FR7) or that the first visible column is not kept across column changes (FR8), although the description says the hook's docs state the later slices..changeset/table-columns-virtualization.mdsays Tables that do not opt in "carry none of the column windowing code", but every Table import now carries the list validation, the column branches and the inline geometry (CI's import-boundaries check: Table 127.0 KB to 127.5 KB gzip).
An engineering owner's /approve-spec for this head settles releasing before FR7, FR8, FR10 and the PR3/PR4 timing evidence, with the wiring over the 0.3 KB allowance in architecture:component-import-boundaries INV7 that the description states. That approval is bound to this commit, so after the fixes an engineering owner records it again by commenting /approve-spec <full head SHA> on the new head; the author may do so as an engineering owner.
Claims and files checked
- Verified: the hook returns an opaque capability under its own shared key, which the rows reader rejects (hook source, unit test).
- Verified: the prop takes one capability or a list with at most one per axis; any other list renders without windowing and warns once (resolver, unit test).
- Verified: only the unpinned run windows, with layout-floor pitches and two overscan columns per side; a wide enough scroll area mounts every column (column window source, unit tests, CI browser run).
- Verified: header and body rows share one spacer structure, and spacers are empty, unpadded and not focusable (unit test; CI measured no drift).
- Verified: the column count and positions appear only while columns window (unit test, CI browser run).
- Verified: the server and first client use the same seed, less both pinned runs (unit test).
- Verified: inline geometry rides the runtime's one subscription, and the inline offset is read only while a column subscriber exists (runtime source).
- Verified: admission fallbacks, including a spanning cell found after mount and a wide minimum width, each warn (unit tests).
- Verified: Table reaches the window only through the passed value, and the import-boundaries check holds with no allowlist change (CI lint).
- Verified: adding or removing the capability remounts the Table, and a seed change does not (unit tests).
- Verified: a Table without the hook carries about 0.4 KB more gzip (CI lint and size report), over the record's 0.3 KB allowance, which the owner approval accepts.
- Verified: the pinned-run registry is shared across copies and gives the start run precedence (registry and sticky plugin source).
- Verified: an empty first render windows its columns once rows arrive (unit test).
- Verified: the CLI example block and its route entries build (CI docsite build).
- Verified: the inline range lives in the shared windowing module with its own unit tests (source, tests).
- False: the later slices are stated in the hook's docs; only the rows-and-columns limit is.
- Core changeset: behavior statements verified; false: Tables that do not opt in carry none of the column windowing code.
- Verified: the CLI changeset's 121-column example with a pinned first column (block source).
- Finding:
.changeset/table-columns-virtualization.md,packages/core/src/Table/useTableColumnsVirtualization.doc.mjs. - Non-blocking note:
packages/core/src/Table/plugins/virtualization/useTableColumnWindow.ts(a comment that restates its memo). - Clear:
packages/core/src/Table/BaseTable.tsx,Table.tsx,Table.doc.mjs,types.ts,index.ts,tableColumnWindowing.ts,tablePinnedColumnRuns.ts,tableRuntime.ts. - Clear:
packages/core/src/Table/plugins/virtualization/TableColumnWindow.tsx,useTableColumnsVirtualization.ts,index.ts,useTableColumnsVirtualization.test.tsx;packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx;packages/core/src/Table/__tests__/TableColumnWindowing.a11y.chromium.spec.ts. - Clear:
packages/core/src/virtualization/listWindow.ts,listWindow.test.ts,useInlineListWindow.ts. - Clear:
.changeset/table-columns-virtualization-cli-example.md,packages/cli/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx,ColumnsVirtualizationHookUsage.doc.mjs,apps/storybook/stories/TableVirtualization.stories.tsx,apps/sandbox/scripts/next-export-routes.json,internal/shadcn-registry/routes.lock.json.
f70735c to
943de98
Compare
|
/approve-spec 943de98 |
There was a problem hiding this comment.
Approved: column windowing follows the current Table and module records for what this slice builds, and both wording fixes from the last review are in.
An engineering owner's /approve-spec on this commit covers releasing before the module's focused-column, first-visible-column and rows-and-columns requirements and its timing evidence, with Table wiring over the 0.3 KB allowance in architecture:component-import-boundaries INV7. Three non-blocking suggestions are inline: the tableColumnWindowing.ts header still says a Table that never imports the hook carries none of the column windowing code, the hook doc's docsDense leaves out the release caveats, and no test shows that an admission fallback keeps the table mounted.
Claims and files checked
- Verified: the hook returns an opaque capability under its own shared key, which the rows reader rejects (hook source, unit test).
- Verified: the prop takes one capability or a list with at most one per axis; any other list renders without windowing and warns once (resolver, unit test).
- Verified: only the unpinned run windows, with layout-floor pitches and two overscan columns per side; a wide enough scroll area mounts every column (column window source, unit tests, Chromium spec).
- Verified: header and body rows share one spacer structure, and spacers are empty, unpadded, borderless and not focusable (unit test, Chromium spec).
- Verified: the column count and positions appear only while columns window (unit tests, Chromium spec).
- Verified: the server and first client use the same seed, less both pinned runs (unit tests).
- Verified: inline geometry rides the runtime's one subscription, and the inline offset is read only while a column subscriber exists (runtime source).
- Verified: each admission fallback warns, including a spanning cell found after mount and a wide minimum width (unit tests).
- Verified: Table reaches the window only through the passed value, the import-boundaries check holds with no allowlist change, and Table grows from 127.0 KB to 127.5 KB gzip (CI lint at this head); the per-part byte breakdown is an estimate and was not checked.
- Verified: the pinned-run registry is shared across copies and gives the start run precedence, as the sticky offsets do (registry and sticky plugin source).
- Verified: an empty first render windows its columns once rows arrive (unit test, empty-state guard).
- Verified: the example block, its route entries and the route lock (block source, CI docsite build).
- Verified: the inline range lives in the shared windowing module with its own unit tests (source, tests).
- Verified: adding or removing the capability remounts the table and a seed change does not (unit tests); an admission fallback keeps the table mounted by construction, with no test.
- Verified: the hook doc's description states the later slices (focus loss, first visible column, rows and columns together); the dense doc does not.
- Verified: the new exports and the widened prop keep every existing call valid (exports, types).
- Verified, wording stale: the governing module record is current on the main branch; the description still places it on the stacked spec pull request, which has merged.
- Not checked locally: the author's command results and test counts (CI at this head used instead).
- Core changeset: every statement verified, including the focus and first-visible-column caveats and the 0.4 KB wiring (source, CI lint).
- CLI changeset: verified, a 121-column example with a pinned first column (block source).
- Note (non-blocking):
packages/core/src/Table/tableColumnWindowing.ts(file header),packages/core/src/Table/useTableColumnsVirtualization.doc.mjs(dense doc),packages/core/src/Table/plugins/virtualization/useTableColumnWindow.ts(a comment that restates its memo),packages/core/src/Table/plugins/virtualization/useTableColumnsVirtualization.test.tsx(no fallback-remount test). - Clear:
packages/core/src/Table/BaseTable.tsx,Table.tsx,Table.doc.mjs,types.ts,index.ts,tablePinnedColumnRuns.ts,tableRuntime.ts. - Clear:
packages/core/src/Table/plugins/virtualization/TableColumnWindow.tsx,useTableColumnsVirtualization.ts,index.ts;packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx;packages/core/src/Table/__tests__/TableColumnWindowing.a11y.chromium.spec.ts. - Clear:
packages/core/src/virtualization/listWindow.ts,listWindow.test.ts,useInlineListWindow.ts. - Clear:
.changeset/table-columns-virtualization.md,.changeset/table-columns-virtualization-cli-example.md,packages/cli/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx,ColumnsVirtualizationHookUsage.doc.mjs,apps/storybook/stories/TableVirtualization.stories.tsx,apps/sandbox/scripts/next-export-routes.json,internal/shadcn-registry/routes.lock.json.
| * @position Table's base wiring for column windowing. The column hook puts | ||
| * its implementation in the capability value, so a Table that never | ||
| * imports the hook carries none of the column windowing code. |
There was a problem hiding this comment.
Non-blocking: this header still says a Table that never imports the hook "carries none of the column windowing code", the wording the changeset dropped. This module is the wiring every Table import carries (CI's import-boundaries check: Table 127.0 KB to 127.5 KB gzip). Suggested:
* @position Table's base wiring for column windowing: the shared key, list
* validation and layout types. The column planner and window load only
* with the hook.| /** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */ | ||
| export const docsDense = { | ||
| description: | ||
| 'Geometry-only column windowing opt-in for Table.virtualization. Keep full data, columns and a stable idKey on Table. Declared widths set the window; pinned columns always mount; a wide enough scroll area mounts every column. Unsupported content or structure renders every column. Native mounted-cell semantics, not discovery of unmounted columns. Adding or removing the capability remounts the table.', |
There was a problem hiding this comment.
Non-blocking: docsDense leaves out the caveats the description now states, so the dense docs give a builder no warning about them. Suggested addition: "Not yet: rows and columns together (the rows window, every column renders); focus in an unpinned column is lost when it scrolls out; column changes do not keep the first visible column."
943de98 to
973a981
Compare
|
/approve-spec 973a981 |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision for this head, and the description needs a refresh.
- Owner decision: releasing
useTableColumnsVirtualizationbefore the module record's FR7 (retained focused column), FR8 (first-visible-column anchor), FR10 (rows and columns together) and PR3/PR4 timing evidence, with about 0.5 KB gzip of column wiring in every Table import (over the import-boundaries record's 0.3 KB allowance), was approved for the previous head only, so an engineering owner records it for this rebased head by commenting/approve-spec <full head SHA>(the author may, as an engineering owner), or says the hook stays unexported. - The description still describes the previous tree: it says the branch sits on an older
main, that the Testing runs used this exact tree, and that Table grows from 127.0 KB to 127.5 KB, while this head carries a conflict resolution withuseTableInfiniteScrolland CI measures 127.2 KB to 127.7 KB. - Miss: the description says unit tests cover all three remount cases, though none shows that an admission fallback keeps the table mounted, and it places the module record on a stacked spec PR although the record is current on
main; the last review listed both only as non-blocking.
CI passes at this head, including the column-windowing Chromium spec (10 of 300 columns mounted at the start, 12 mid-scroll, no header and body drift). Non-blocking: the tableColumnWindowing.ts header still says Tables that do not opt in carry none of the column code, docsDense leaves out the release caveats, and the spanning-cell check does not re-run when only the data changes.
Claims and files checked
- Claim: the hook returns an opaque capability under its own shared key that the rows reader rejects: verified (
tableColumnWindowing.ts, unit test). - Claim:
Table.virtualizationtakes one capability or a list with at most one per axis, and any other list renders unwindowed with one warning: verified (resolveTableVirtualization, unit test). - Claim: only the unpinned run windows, with floor-width pitches, two overscan columns per side, and every column mounts when the scroll area is at least the minimum width: verified (
TableColumnWindow.tsx,useTableColumnWindow.ts, unit tests, Chromium spec). - Claim: header and body rows share one structure with empty, inaccessible spacers: verified (unit test, Chromium spec).
- Claim:
aria-colcountand full-tablearia-colindexappear only while columns window: verified (unit tests). - Claim: server and first client use the same seed, less both pinned runs: verified (unit tests).
- Claim: inline geometry uses the existing subscription, and
scrollLeftis read only while a column subscriber exists: verified (tableRuntime.ts). - Claim: admission falls back with a warning for each unsupported case, including a spanning cell after mount and a wide minimum width: verified (unit tests).
- Claim: Table reaches the column window only through the passed value, with no new allowlist row: verified (CI import-boundaries check).
- Claim: adding or removing the capability remounts, a new seed does not, and tests cover all three cases: partly false (no test for the admission-fallback case).
- Claim: the pinned-run registry uses a shared key, is imported only by the sticky plugin and the window, and pins a key in both runs to the start: verified (
tablePinnedColumnRuns.ts,useTableStickyColumns.tsx). - Claim: an empty first render windows once rows arrive: verified (
useTableColumnWindow.ts, unit test); its red-first run was not repeated. - Claim: the CLI example block names the hook and is mirrored in the route lists with its own changeset: verified (docsite build).
- Claim: the rebase base, the Testing runs on this exact tree, and Table 127.0 KB to 127.5 KB: false at this head (rebased again, conflict resolution, CI 127.2 KB to 127.7 KB).
- Claim: the module record is on a stacked spec PR: false (current on
main). - Claim: the hook docs state the FR7, FR8 and FR10 limits, and the core changeset states the wiring cost: verified (
useTableColumnsVirtualization.doc.mjs, changeset). - Changesets: the core entry (opt-in, behavior, list form, focus and anchor limits, fallbacks, remount, about 0.4 KB of wiring) and the CLI entry (121-column example block): verified.
- Files:
BaseTable.tsx,Table.tsx,types.ts,index.ts,tableRuntime.ts,tableColumnWindowing.ts,tablePinnedColumnRuns.ts,useTableStickyColumns.tsx,plugins/virtualization/index.ts,TableColumnWindow.tsx,useTableColumnsVirtualization.ts,listWindow.ts,useInlineListWindow.ts: clear. - Files:
useTableColumnWindow.ts: non-blocking (comment restates a memo; spanning check misses data-only changes). - Files:
useTableColumnsVirtualization.test.tsx,listWindow.test.ts,TableColumnWindowing.a11y.chromium.spec.ts,TableVirtualization.stories.tsx: clear (the description's remount-test claim is the finding). - Files:
useTableColumnsVirtualization.doc.mjs: non-blocking (docsDensecaveats);Table.doc.mjs, the CLI example block and its doc, both changesets,routes.lock.json,next-export-routes.json: clear.
| // eslint-disable-next-line @eslint-react/set-state-in-effect -- records a violation read from mounted cells | ||
| setRejected({widths, seed: initialViewportWidth, reason}); | ||
| } | ||
| }, [isWindowed, hasRows, segments, table, widths, initialViewportWidth]); |
There was a problem hiding this comment.
Non-blocking (module FR11): this check runs again only when the range, widths, seed or row presence change. A custom plugin whose transformBodyCell sets colSpan for some rows can bring a spanning cell in with new data while the mounted range stays the same, and then the window never latches the fallback, so that row's cells drift from the header. No first-party flat plugin sets colSpan; adding the row keys (or the row count) to the dependencies would close it.
|
/approve-spec 973a981 |
973a981 to
ad86a1a
Compare
|
/approve-spec ad86a1a |
There was a problem hiding this comment.
Changes requested: one sentence in the description still claims test coverage that the tests do not have; the engineering owner's decision for this head covers shipping before focus retention, the column anchor, rows-and-columns windowing and the timing evidence, and the extra wiring size, so this is the only blocker.
- Miss: the "Remount on toggle" paragraph still says "Unit tests cover all three" although no test shows that an admission fallback keeps the table mounted, so delete that sentence or add the sibling test (render windowed, rerender with
textOverflow="wrap", expect the same<table>element).
Non-blocking: the Testing passage's "CI at this head: 127.2 → 127.7 KB" now reads 127.5 KB → 128.0 KB because CI compares against the current main (the +0.5 KB growth is unchanged), and the open notes on the tableColumnWindowing.ts header, the docsDense caveats and the spanning-cell re-check still apply. A Chromium check of this head's Storybook build mounts 10 of 300 columns at the start and 12 mid-scroll, with header and body aligned.
Claims and files checked
- Claim: the hook returns an opaque capability under its own shared key that the rows reader rejects: verified (
tableColumnWindowing.ts, unit test). - Claim:
Table.virtualizationtakes one capability or a list with at most one per axis, and any other list renders unwindowed with one warning: verified (resolveTableVirtualization, unit test). - Claim: only the unpinned run windows, with floor-width pitches and two overscan columns per side, and every column mounts when the scroll area is at least the minimum width: verified (
TableColumnWindow.tsx,useTableColumnWindow.ts, unit tests, Chromium check). - Claim: header and body rows share one structure with empty, inaccessible spacers: verified (unit test, Chromium check).
- Claim:
aria-colcountand full-tablearia-colindexappear only while columns window: verified (unit tests, Chromium check). - Claim: server and first client use the same seed, less both pinned runs: verified (unit tests).
- Claim: inline geometry uses the existing subscription, and the inline scroll position is read only while a column subscriber exists: verified (
tableRuntime.ts). - Claim: each unsupported case falls back with a warning, including a spanning cell after mount and a wide minimum width: verified (unit tests).
- Claim: Table reaches the column window only through the passed value, with no new allowlist row: verified (CI import-boundaries check).
- Claim: adding or removing the capability remounts and a new seed does not: verified (unit tests); an admission fallback keeps the table mounted: true by construction, untested; "unit tests cover all three": false.
- Claim: every Table import grows by about 0.4 to 0.5 KB gzip: verified (CI: +0.5 KB); the quoted absolute sizes for this head: stale, as
mainmoved. - Claim: the pinned-run registry uses a shared key, only the sticky plugin and the window import it, and a key in both runs pins to the start: verified (
tablePinnedColumnRuns.ts,useTableStickyColumns.tsx). - Claim: a Table whose first render is empty windows once rows arrive: verified (
useTableColumnWindow.ts, unit test); the red-first run was not repeated. - Claim: the CLI example block names the hook and is mirrored in both route lists, with its own changeset: verified.
- Claim: the shared windowing module gains an inline hook and a variable-size range with unit tests: verified (
useInlineListWindow.ts,listWindow.ts,listWindow.test.ts). - Claim: focus retention, the column anchor, rows and columns together and the timing evidence are later slices, stated in the hook docs and the warning: verified (hook doc, development warning, open follow-up pull request).
- Claim: the branch sits on the current merge base, and the infinite-loading resolution keeps the unknown row count and the loading empty-state guard: verified (
BaseTable.tsx). - Claim: the module record is current on
main: verified. - Claim: the public delta is the new hook and config type and the widened prop, with no theme target or data attribute: verified (CI API report, source).
- Claim: CI at this head passes every check, including the Chromium specs: lint, typecheck, build, docsite, interaction and visual checks pass; the label-gated accessibility browser specs did not run.
- Changesets: the Core entry (opt-in, behavior, list form, focus and anchor limits, fallbacks, remount, wiring cost) and the CLI entry (121-column example block): verified.
- Files:
BaseTable.tsx,Table.tsx,types.ts,index.ts,tableRuntime.ts,tablePinnedColumnRuns.ts,useTableStickyColumns.tsx,plugins/virtualization/index.ts,TableColumnWindow.tsx,useTableColumnsVirtualization.ts,listWindow.ts,useInlineListWindow.ts: clear. - Files:
tableColumnWindowing.ts: non-blocking (header overstates what a Table without the hook carries). - Files:
useTableColumnWindow.ts: non-blocking (a comment restates a memo; the spanning check misses data-only changes). - Files:
useTableColumnsVirtualization.test.tsx,listWindow.test.ts,TableColumnWindowing.a11y.chromium.spec.ts,TableVirtualization.stories.tsx: clear (the description's remount-test claim is the finding). - Files:
useTableColumnsVirtualization.doc.mjs: non-blocking (docsDensecaveats);Table.doc.mjs, the CLI example block and its doc, both changesets,routes.lock.json,next-export-routes.json: clear.
Table.virtualization accepts a columns capability, alone or in a list with at most one rows capability. Table mounts only the unpinned columns near the inline viewport, plus two overscan columns per side, and keeps the pinned start and end runs mounted. Each column's pitch is the width it renders at the table's minimum width. The header row and every body row render the same inaccessible spacer cells for unmounted columns. While columns window, the table carries aria-colcount and mounted cells carry full-table aria-colindex. The server and first client use the same seed from initialViewportWidth. Inline geometry comes from the shared Table viewport measurement. The capability carries the column window, a component, under a shared key. Table renders that component around its table and reads no column planner code of its own, so a Table that never imports the hook carries none of it. Adding or removing the capability remounts the table; a new seed does not. The pinned-run registry moves to its own module, which only the sticky columns plugin and the column window import. A Table whose first render has no rows windows its columns once rows arrive: the empty-state cell no longer counts as a cell that spans columns. Unsupported content or structure renders every column with a development warning. With both capabilities, this slice windows the rows and renders every column. The retained focused column, the first-visible-column anchor and windowing both axes together come in later slices. Adds the hook's CLI example block. This diff was generated with AI assistance (Navi). Tags: ai-generated
ad86a1a to
ad3261d
Compare
|
/approve-spec ad3261d |
There was a problem hiding this comment.
Approved pending CI: the Node test leg 4 of 5 is running again on this commit. Its first run hit the 15-minute job limit with no failing test, and every other check passed. Column windowing follows the current Table and module records for everything this slice builds, and shipping before focus retention, the inline anchor, rows-and-columns windowing and the timing evidence, along with the extra wiring every Table now carries, has an engineering owner's decision for this commit. The earlier description point is fixed, and only optional cleanups remain:
- Miss: the pinned-run resolver in
useTableStickyColumns.tsxreadsstateRef.currentwhile Table renders; closing overstartandendreads the values themselves. - The
tableColumnWindowing.tsheader anddocsDensein the hook doc still leave out what the changeset says: the wiring every Table carries, and the focus, anchor and rows-and-columns caveats.
Claims and files checked
- Claim: the hook returns the shared opaque capability under its own key, and the rows reader rejects it. Verified (hook and key modules; capability identity test).
- Claim:
Table.virtualizationtakes one capability or a list with at most one per axis; other lists render unwindowed and warn. Verified (list resolver; invalid-list test). - Claim: only the unpinned run windows, with two overscan columns per side, floor-width pitch, and every column at full width. Verified (window and planner; pinned, middle and wide-viewport tests; browser check of the story).
- Claim: header and body rows share one spacer structure, and spacers are empty, unpadded and unfocusable. Verified (spacer cell; structure test; browser check).
- Claim:
aria-colcountandaria-colindexappear only while columns window. Verified (BaseTable; position tests). - Claim: the server and the first client share a seed that subtracts both pinned runs. Verified (inline window; server and end-pinned seed tests).
- Claim: inline geometry uses the existing runtime subscription, and
scrollLeftis read only with a column subscriber. Verified (tableRuntime.ts). - Claim: admission checks and per-case warnings, including the spanning cell and a wide
min-width. Verified (fallback reasons; admission tests). - Claim: Table reaches the column window only through the capability, with no allowlist row, and the boundary check passes. Verified (imports; CI lint on this commit).
- Claim: a Table import grows by about 0.4–0.5 KB gzip. Verified (CI: 127.5 KB to 128.0 KB); the per-part byte breakdown is the author's estimate.
- Claim: the pinned-run registry is shared across copies, and only the sticky plugin and the column window import it. Verified (registry module; imports).
- Claim: a Table whose first render is empty windows once rows arrive. Verified (row-presence guard; empty-start test).
- Claim: the example block names the hook, appears in the sandbox routes and the route lock, and has its own CLI changeset. Verified (block, route files, changeset; CI docsite build).
- Claim: the range math lives in the shared windowing module beside the rows hook. Verified (inline window and range function; unit tests).
- Claim: focus retention, the inline anchor and rows-and-columns windowing are not built, and the docs and warning say so. Verified; the timing evidence is release evidence with no behavior to document.
- Claim: adding or removing the capability remounts the table and a seed change does not; tests cover both, with no test for a fallback. Verified (render structure; remount and seed tests).
- Claim: the rebase keeps infinite loading's row count and initial empty state. Verified (BaseTable).
- Claim: new exports, the widened prop, and no theme target or data attribute. Verified (entry files; CI API analysis).
- Claim: default text truncates with the capability. Verified (BaseTable).
- Claim: CI on this commit passes. Verified for every finished check; one Node test leg is running again after its first run hit the time limit with no failing test.
- Claim (core changeset): windowing, positions, full-width mounting, the list form, the behavior with both capabilities, the focus and anchor caveats, fallback warnings, remount and the wiring cost. Verified.
- Claim (CLI changeset): a 121-column example with a pinned first column. Verified.
- Files: all 26 changed files were read. Optional notes:
useTableStickyColumns.tsx(render-time ref read),tableColumnWindowing.ts(stale header),useTableColumnsVirtualization.doc.mjs(dense doc caveats),useTableColumnWindow.ts(spanning-cell recheck, one narrating comment),useTableColumnsVirtualization.test.tsx(no renderer-count test for in-range scrolls). Clear: the other 21 files.
| [attachScrollShadow], | ||
| ); | ||
| registerPinnedColumnRuns(plugin, columns => | ||
| countPinnedRuns(columns, stateRef.current.start, stateRef.current.end), |
There was a problem hiding this comment.
Non-blocking (INV17): this resolver runs while Table renders and reads stateRef.current, a latest-value ref, instead of the values. The hook registers it again on every render, so it can close over them:
registerPinnedColumnRuns(plugin, columns =>
countPinnedRuns(columns, start, end),
);As written, moving stateRef to useCommittedRef would leave the pinned runs one render behind.
User need
Builders with wide Tables (hundreds of columns, such as metric or spreadsheet-style views) pay for every cell in every row even though only a handful of columns are on screen. Row windowing bounds the block axis but not the inline one, so a 300-column, 200-row table still mounts 60,000 cells. Paging columns or hiding them changes what the user can reach and breaks header association, so composition does not solve it.
Problem and solution fit
This is the first implementation slice of
module:Table/useTableColumnsVirtualization:useTableColumnsVirtualization({initialViewportWidth})returns the same opaqueTableVirtualizationCapabilitytype as the rows hook, read through its own registered key, so each reader accepts only its own axis.Table.virtualizationtakes one capability or a list with at most one rows and one columns capability (FR12). Any other list renders without windowing and warns once in development.resolveColumnFloorWidths, the same widths pinned offsets use (FR3). Two overscan columns per side. When the scroll area is at least the table's minimum width, every column mounts.<td>for each unmounted run, the mounted cells and the pinned end cells (FR4). Spacers have the summed pitch, no content, padding, border or focus stop.aria-colcountand each mounted header and body cell carries its full-tablearia-colindex(FR5). Without windowing, neither attribute is added.initialViewportWidthless the widths of both pinned runs, plus overscan (FR6).clientWidthand a logicalscrollLeft(absolute value, so right-to-left tables read the distance from the inline start). The runtime readsscrollLeftonly while a column subscriber exists, so row-only tables do no extra work on inline scroll.wrap, no unadmitted custom renderer). A cell that spans columns, found on mounted cells after commit, latches the same fallback. A Table whose ownmin-widthexceeds the sum of the column widths renders every column (FR3). Each case warns once in development.Import boundary (
architecture:component-import-boundariesINV7). Table reaches the column window only through the value the caller passes. No allowlist row is added.{initialViewportWidth, windowing}, wherewindowing.Windowis a component (plugins/virtualization/TableColumnWindow.tsx). The hook module imports it statically, and nothing has a module-level side effect, so it tree-shakes with the hook.Table/tableColumnWindowing.ts. Table passes the column window its shared admission result and whether the resolved columns are single-line. Admission is keyed by column object, so the window does not judge the sized copies. It holds the shared key, the list validation (FR12) and the layout types; BaseTable also has a fewimport typelines.<Window capability input render>. The component calls the column planner's hooks behind its own boundary, thenrender(layout), as in the draftWindowpattern in refactor(Table): a Table that never windows carries no windowing code (prototype) #10827. No hook is called from a value.useTableColumnWindow),useInlineListWindow, the spacer cells, the column admission checks and pitches, and the pinned-run lookup.component:Table: adding or removing an identity-dependent capability mode is a remount boundary, and a geometry change inside the mode is not. Changing onlyinitialViewportWidthkeeps the same component and does not remount, and neither does an admission fallback inside the window. The hook docs and the changeset say so. Unit tests cover adding and removing the capability and a seed change. An admission fallback keeps the same component by construction, because the fallback renders inside the column window; no test covers that case yet.pnpm check:component-import-boundaries --base-ref origin/mainpasses with no allowlist change.Table/BaseTable→useTableColumnWindowmain)The +445 bytes measured on the previous head are what a Table without the hook still carries; CI measures about the same on this head:
subscribeInlinein the one shared geometry source, which FR9 needs on the existing subscription: about 75 bytes;aria-colindex/aria-colcountand spacer-mapping branches: about 35 bytes;truncatedefault and glue: the rest.Getting under 0.3 KB means moving list validation behind the capability, or giving the geometry source a generic extension point. Both restructure the rows path, so this PR stops here.
Pinned runs. No existing seam told Table which columns the sticky plugin pins: the plugin keeps its keys in a private ref and writes offsets only in cell transforms. This PR adds the smallest internal mechanism,
Table/tablePinnedColumnRuns.ts, withregisterPinnedColumnRuns(plugin, resolve)andresolvePinnedColumnRuns(plugins, columns). It is asharedWeakMap('table/pinned-column-runs', 1)keyed by plugin object, so a copied plugin and the package Table agree. OnlyuseTableStickyColumnsand the column window import it; Table itself never does. The sticky plugin registers a resolver that counts its runs with the same precedence as its offsets: a key in both runs pins to the start. Nothing public changes, and Table never reads the plugin's config.Empty first render. A Table that first renders with
data={[]}now windows its columns once rows arrive. The empty-state<td colSpan>had tripped the spanning-cell check and latched the fallback. The check now runs only while the body has data rows. The test (empty, then data, then columns window) failed before the fix and passes after.CLI example (
architecture:knowledge-contractsINV28).packages/cli/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.{tsx,doc.mjs}hasexampleFor: 'useTableColumnsVirtualization': 121 columns, a pinned first column and the seed. It is mirrored in the sandbox export routes and the ShadCN route lock, which the docsite generator verifies, and has its own@astryxdesign/clichangeset.Shared windowing module. Column windowing runs through the private list-windowing module (
architecture:list-windowingINV1), not a Table-only engine:packages/core/src/virtualization/useInlineListWindow.tsis the module's inline-axis hook, besideuseListWindow. It reads the shared inline geometry, subtracts the viewport space covered at each edge, and plans the item range and its segments.packages/core/src/virtualization/listWindow.tsgainscalculateVariableListRange, a binary search over prefix offsets for items of varying size, with unit tests beside the fixed-pitch ones. Segments reusecreateListWindowSegments.Table/plugins/virtualization/useTableColumnWindow.tsis Table's adapter, behind the hook. It maps the windowed run between the pinned runs to full-table column positions and spacer widths, and owns the spanning-cell admission.TableColumnWindow.tsxadds the column admission, pitches and spacer rendering.useListWindowitself does not serve columns: it is a fixed-pitch, block-axis hook (rowHeight,scrollTop/viewportHeight/startOffset,scrollTopwrites). Columns need per-item widths, the inline axis with logical offsets in right-to-left tables, and inset pinned runs. Generalising it would change the rows hook's inputs and outputs, a larger change to the shared engine; the inline hook sits beside it in the same module and shares its pure range and segment math.Later slices
Not in this PR, and stated in the hook's docs and dev warning:
Rebase onto main
Rebased onto
main95449a2, with a conflict resolution against Promise-based infinite loading (see "Rebase onto main (973a981)" below). The spec is merged, so the base is nowmain.packages/core/api-report.mdis gone from main, so this PR no longer touches it. The inline range lives in the shared module asuseInlineListWindow,calculateVariableListRangesits inlistWindow.ts, and the runtime snapshot uses main'sstartOffset.Current specification
docs/specs/components/Table/plugins/virtualization/useTableColumnsVirtualization.spec.md(FR1–FR6, FR9, FR11, FR12; DEC-1 to DEC-3), current onmain(spec(Table): column virtualization windows the unpinned columns #11013).component:TableFR18 (Table.virtualizationtakes one capability or a list with at most one per axis), FR13 (column floors) and FR19 (shared viewport).Public delta and caller burden
@astryxdesign/coreand the Table subpath:useTableColumnsVirtualization,UseTableColumnsVirtualizationConfig.Table.virtualization/BaseTable.virtualizationwiden fromTableVirtualizationCapabilitytoTableVirtualizationCapability | ReadonlyArray<TableVirtualizationCapability>. Every existing call stays valid.data-*attribute. Spacers are plainaria-hiddencells.idKey; content stays single-line (defaulttextOverflowbecomestruncatewhen the capability is present, as with rows).Specification coverage
Six points raised during implementation are now settled in the current record on the base branch, and this PR follows each:
initialViewportWidth(FR6); a unit test proves the server seed equals the first client range with an end-pinned run.No known gap remains between this slice and the record, apart from the later slices listed above.
Design and alternatives
The spec rejects a uniform
columnWidthand measuring offscreen columns (DEC-3), windowing pinned columns (DEC-2), and a second Table prop or a combined hook (DEC-1). While windowed, mounted header cells take their pitch in pixels rather than their percentage share: at the table's minimum width the two are equal, and a pixel width cannot resolve against the spacers.Evidence
aria-colcount/aria-colindexonly while windowed; pinned start and end runs always mounted with unchanged offsets; middle-of-run window from measured width and scroll position, also in right-to-left; a viewport or seed at least the table minimum width mounts every column; no change without the capability; admission fallbacks and warnings for seed, wrap, custom renderer, non-flat rows, duplicate identity, spanning cell, wide min-width and rows+columns; list validation.Core/Table virtualization/Column windowing: 300 columns × 200 rows, pinned 160px first column, 900px viewport, 120px columns): see Testing.Scope
Components: Table, useTableColumnsVirtualization, useTableStickyColumns
Testing
These local runs used the previous tree (943de98 on
main06b7e61). This head rebased ontomain95449a2 with a conflict resolution inBaseTable.tsx; local installs were unavailable (registry errors), so CI at this head is the authority: every check passes, including lint (import boundaries), typecheck, tests, the docsite build, Storybook and the Chromium specs.vitest run --project ui packages/core/src/Table packages/core/src/virtualization packages/core/src/utils(cd packages/core && pnpm typecheck)prettier --checkandeslint --max-warnings=0on every changed filevitest run scripts/shared-identity.test.mjsnode scripts/check-knowledge.mjsnode scripts/sync-exports.js --checkpnpm check:component-import-boundaries --base-ref origin/mainmain: about +0.5 KB)node scripts/release/changeset-coverage.mjs pr --base origin/main --head HEAD@astryxdesign/coreand@astryxdesign/clinamed)pnpm buildnode apps/docsite/scripts/generate-data.mjs(route lock and registries)build-previews+next buildpnpm storybook:build, then Playwright--project=chromiumTableColumnWindowing TableWindowedTextSize TableVirtualization.a11y TableWindowedCard TableScroll TableMinWidthReview fixes (943de98)
Rebase onto main (973a981)
mainmerged Promise-based infinite loading (#10570), which edits the same part ofBaseTable.tsx. This slice keeps its render function for everything that reads the column layout, and that function now carries #10570's two changes:aria-rowcountis-1while an admitted loading source reports more rows, and the default empty state stays hidden while the first rows load. #10570's loading source, admission and runtime-context field merged unchanged.