Repository navigation
fix(Table): a row expansion toggle re-renders no other row - #13359
Conversation
… and panel useTableRowExpansion rebuilt its plugin object whenever expandedKeys changed (and whenever a caller passed new inline callbacks), so BaseTable re-rendered every row on each toggle. On the 2,002-row story that was a 1.4-2.9 s commit on desktop (5-9 s at 4x CPU), and the first one built React alternates for 128,060 of 134,098 fibers (+212 MB heap), which on iOS Safari gave a ~11 s stall and tab reloads. The plugin now keeps its identity: the callbacks are read through a ref, and the expanded keys reach the chevron, the panel and the glide's measurement through a small store each of them subscribes to. The row's divider gives way to its open panel through TableCell's own divider style (:has(+ [data-expansion-panel])), so no row needs to render for it, and the context-menu action reads the state when the menu opens.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec c9d2390 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Table | 124.4 kB (+32 B) · 21.2 kB CSS (+68 B) | — | ✗ · ✓ · — |
| TableRow | 7.2 kB (+31 B) · 4.1 kB CSS (+15 B) | — | ✗ · ✓ · ✗ |
| TableCell | 106.5 kB (0) · 20.2 kB CSS (+38 B) | — | ✗ · ✓ · ✓ |
8 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableBody | 6.6 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) | — | ✗ · ✓ · ✗ |
| TableHeaderCell | 106.3 kB (0) · 20.0 kB CSS (0) | — | ✗ · ✓ · ✓ |
| TableSelectionToolbar | 77.9 kB (0) · 14.5 kB CSS (0) | — | ✗ · ✓ · ✓ |
| Markdown | 209.2 kB (+49 B) · 23.5 kB CSS (+69 B) | — | — · — · — |
| lab/Comments | 388.7 kB (+51 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 381.7 kB (+35 B) · 2.4 kB CSS (0) | — | — · — · — |
Visual changes: 2 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Inheritance checked against the 7 newest reports of other pull requests.
Package size: @astryxdesign/core 7.97 MB packed (+3.1 kB); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the toggle no longer re-renders every row, but the way the plugin keeps its identity breaks updates to the caller's options and a React runtime rule.
- The hook writes
latestRef.current = configduring render and rows read that ref while rendering (useTableRowExpansion.tsx:806-807,:1060-1068,:1113-1116,:1196-1199), whichreact-component-runtimeINV17 and INV3 forbid, so putonTogglebehinduseCommittedReffor the handlers and read the render-time callbacks as values (memo inputs, or through the store the chevron and panel already subscribe to). - Changed
getIsItemExpandableorgetRowLabelresults never reach mounted rows: a memoizedgetIsItemExpandablethat turns false leaves every chevron in place and a click still opens a panel on that row, and a changedgetRowLabelkeeps the old accessible names, wheremainupdates both. - The two new layout effects (
:745,:809) do not name what they synchronize, which INV3 requires. - The title and changeset say only the toggled row's chevron and panel re-render, but every open panel re-renders on each toggle and on each render of the caller, so reword them (for example "re-renders no other row; only the toggled chevron and the open panels update").
Before approval the description also needs the physical-iPhone result for the iOS Safari claim (device, iOS and Safari version, head, result) or a changeset without that wording, and the first-load gzip delta for a Table page without expansion (the repository's boundary check gives 119.9 KB on the merge base and 120.0 KB on this head). A test that changes both callbacks' results across a caller re-render would lock the fix in.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a toggle no longer re-renders the other rows, inline callbacks included. Verified: both new tests fail on
mainand pass here. - Claim: only the toggled row's chevron and panel update. False: open panels re-render too (see above).
- Claim: the fix stops the freeze and reload on iOS Safari. Not yet shown on a device.
- Claim: the desktop and 4x CPU timings, and the heap numbers. Stated in the description; not reproduced here.
- Claim: the chevron, its accessible name, the panel, the divider, the glide, row-click expansion and the context-menu action are unchanged. The divider and glide end states were verified in Chromium, and row click and the context menu by the unit suite. The accessible name and expandability are false once a callback's result changes.
- Claim: the public options are unchanged. Their types are unchanged; how they behave when they change is not (see above).
- Claim: callbacks are read through a ref, as the selection plugin already does. True as a description, but that pattern is itself a listed runtime gap.
- Claim: no new effect, protocol or public API. Verified for the protocol and the API (no public API rows change); false for the effect, since a new one is added.
- Claim: the keys reach the cells in a layout effect, before paint. Verified.
- Claim: the glide's play step runs in the commit that changes the panel. Verified.
- Claim: the context-menu action reads the open state when the menu opens. Verified.
- Claim: the divider rule lives in
TableCell, and an app's or theme's border still wins. Verified in Chromium with an app override on the cells. - Claim: the Table unit suites pass (939). Verified. Claim: lint passes. Verified for the changed files; the other checks were not re-run.
- File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: the render-time ref, stale options and Effect-note findings; comment-style suggestions. - File
packages/core/src/Table/TableCell.tsx: clear. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear. The new cases do not cover a callback change across a re-render. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: the wording finding, and the iOS evidence it needs.
… and the record states the rule WebKit re-evaluates a sibling-relative :has() against earlier siblings on each insertion (the Button and ChatMessage records), the wrong cost for a 2,000-row table. The open panel now marks the row above it from a ref callback (data-expansion-panel-open), and TableCell keys its divider on that mark. module:Table/useTableRowExpansion gains FR5: while a row's panel is open, the panel carries the divider below the row, and the row shows none. The store's one layout effect names what it publishes.
|
/approve-spec 7b82f72 |
…wn markup The mark was set only by the open panel's ref callback, which runs on the client, so a server render of an already open row drew the row's divider until hydration. transformBodyRow now adds data-expansion-panel-open to a row that renders open; the panel keeps it in step on toggles after hydration. A renderToString case checks the open row has the mark, its panel follows it, and a closed row has none; it fails without the change.
|
/approve-spec 9d8e0aa |
There was a problem hiding this comment.
Changes requested: the toggle no longer re-renders every row, but the way the plugin keeps its identity stops updates to the caller's options from reaching rows, breaks a React runtime rule, and adds a public data attribute that no record names.
- The hook writes
latestRef.current = configduring render and rows read that ref while rendering (useTableRowExpansion.tsx:816-817,:1072-1080,:1125-1128,:1208-1211), whichreact-component-runtimeINV17 and INV3 forbid, so putonTogglebehinduseCommittedReffor the handlers and read the render-time callbacks as values (memo inputs, or through the store the chevron and panel already subscribe to). - Changed
getIsItemExpandableorgetRowLabelresults never reach mounted rows: a memoizedgetIsItemExpandablethat turns false leaves every chevron in place and a click still opens a panel on that row, and a changedgetRowLabelkeeps the old accessible names, wheremainupdates both. data-expansion-panel-open(useTableRowExpansion.tsx:708,:1218;TableCell.tsx:163,:182) is a new public data attribute that no record names and that only feeds the divider selector, whichpublic-component-apiDEC-2 and the repository'sAGENTS.mdrule out, so carry the open state in a private--_custom property instead (set by a StyleX dynamic style in the row's open markup, and set and cleared by the panel's ref callback).- The new layout effect in
ExpansionSnapshotFromStore(useTableRowExpansion.tsx:755) does not name what it synchronizes, which INV3 requires. - The title and changeset say only the toggled row's chevron and panel re-render, but every open panel re-renders on each toggle and each caller render, and the description's "options unchanged" and "no new effect or public API" claims are untrue, so reword them (for example "re-renders no other row; only the toggled chevron and the open panels update").
Before approval the description also needs the first-load gzip delta for a Table page without expansion (the repository's boundary check gives 119.9 KB on the merge base and 120.0 KB on this head). A test that changes both callbacks' results across a caller re-render would lock the fix in. The mark finds its row as the panel's previous sibling, so finding the row by its key would also keep it right when another plugin adds an afterRow first.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: a toggle no longer re-renders the other rows, inline callbacks included. Verified: both render-count tests fail on
mainand pass here. - Claim: only the toggled row's chevron and panel re-render. False: open panels re-render too.
- Claim: a row rendered open carries the mark in its server markup, and the mark follows toggles. Verified: both tests fail on
mainand pass here. - Claim: what people see and hear is unchanged (chevron, name, panel, divider, glide, row click, context menu). Divider and glide end states are pixel-identical in Chromium and the unit suite covers row click and the menu; the accessible name and expandability are false once a callback's result changes.
- Claim: the public options are unchanged. Their types are unchanged; how they behave when they change is not.
- Claim: callbacks are read through a ref, as the selection plugin already does. True as a description; that pattern is a listed runtime gap, not a precedent.
- Claim: no new effect, protocol or public API. False for the effect and for public surface (the new data attribute); the plugin protocol and exports are unchanged.
- Claim: the keys reach the cells in a layout effect, before paint. Verified.
- Claim: the glide's play step runs in the commit that changes the panels. Verified.
- Claim: the context-menu action reads the open state when the menu opens. Verified.
- Claim: an app's or theme's border on the cells still wins. Verified in Chromium with the story's app override.
- Claim: a sibling
:has()is avoided because of its WebKit cost. Not measured here. - Claim: the desktop, 4x CPU, heap and physical iPhone timings and stills. Stated in the description; not reproduced here.
- Claim: Table's unit suites pass. Verified: 941 pass at this head.
- Claim: the glide, menu, expand-slot, sticky-divider and motion browser specs pass. Not re-run; four Chromium frame pairs are pixel-identical.
- Claim: review:pre, typecheck, lint, knowledge and changeset checks pass. review:pre exits cleanly but lists the two runtime findings above; the others were not re-run.
- Claim: the overlapping pull requests merge cleanly. Not checked.
- Changeset: the fix and its iOS context. The re-render wording is false (above); the iOS result is stated in the description.
- File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: render-time ref, stale options, data attribute, Effect note; non-blocking sibling lookup and comment style. - File
packages/core/src/Table/TableCell.tsx: the data-attribute selector; non-blocking comment style. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear; no case changes a callback's result across a re-render. - File
docs/specs/components/Table/plugins/rowExpansion/useTableRowExpansion.spec.md: clear; FR5 is owner-approved for this head and names no attribute. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: the wording finding.
… row's divider hand-off is a private custom property Per review: no render-time ref. onToggle goes behind useCommittedRef and is read only in the chevron, row-click and menu handlers; getRowKey, getRowLabel, getIsItemExpandable and renderExpanded are memo inputs again, so a changed callback reaches mounted rows (a new test changes two results across a re-render). The store keeps only the expanded keys and syncs with them in one named layout effect; the play effect is named too. The open row's divider hand-off moves from a data attribute to --_table-open-row-divider-width, which TableCell's divider reads, set in the row's open markup and by the panel's ref callback, which now finds its row by key. TableRow starts every row from none, so a table nested in an open row keeps its own dividers.
|
/approve-spec fd43c78 |
module:Table/useTableRowExpansion PR2: a toggle re-renders no row whose expanded state stayed the same, with the gap that a caller whose row callbacks change on every render still re-renders every row.
|
/approve-spec deed3d1 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, and it runs once the pull request is marked ready for review.
A toggle now re-renders no other row while the row callbacks keep their identity. Every finding from the last review is fixed: no render-time ref, option changes reach mounted rows, the divider hand-off uses a private property, both effects are named, and the changeset wording matches the code.
Non-blocking:
- The module record's Intent (line 48) and Ownership boundary (line 60) still say it covers only accessible names and does not own panel anatomy, while FR5 and the new known limit go beyond that; widen those two lines or move FR5 beside Table FR14.
- Two new comments can be shorter (inline suggestions).
Claims and files checked
Review mode: full; reason: spec-record
- Claim: a toggle no longer re-renders the other rows when the four row callbacks keep their identity, and
onTogglecan be inline. Verified: the new render-count test fails onmain(40 cell renders) and passes here (0), and an inline-onToggleprobe stays at 0. - Claim: inline callbacks keep today's behaviour, where every row re-renders. Verified: 40 of 40 in a probe.
- Claim: only the toggled row's chevron and panel update. Verified: each chevron and panel subscribes to its own row's state.
- Claim: a changed row label or expandability result still reaches mounted rows. Verified: the new test passes here, and on
mainas stated. - Claim: what people see and hear is unchanged (chevron, name, panel, divider, glide, row click, context menu). Verified: Table's 941 unit tests pass, and Chromium frames of five states are pixel-identical to
mainwith matching computed dividers. - Claim: a row that renders open hands its divider over in the server markup. Verified: the test fails on
mainand passes here. - Claim: a table nested in an open row keeps its own dividers. Verified in code:
TableRowresets the property on every row. - Claim: the glide's play step runs in the commit that changes the panels. Verified in code and by the glide browser spec.
- Claim: the context-menu action reads the open state when the menu opens. Verified in code.
- Claim: the cause was a plugin memoized over the expanded keys. Verified on
main. - Claim: the one post-commit store publish follows the infinite-scroll plugin's precedent. Verified: that plugin publishes controlled state in a layout effect after commit.
- Claim: the table page grows 41 B gzip (71 B minified) and the other reference pages are unchanged. Verified: 71 B minified and 43 B gzip against the merge base; docs, form and menu are unchanged.
- Claim: Table's unit suites (941) pass. Verified.
- Claim: the glide (14/14), sticky-divider (18/18) and expand-slot browser specs pass. Verified. The cell-menu, root-font-size and motion specs were not re-run.
- Claim: the desktop timings and heap figures before and after. Stated; not reproduced.
- Claim: the physical-iPhone results. Stated for an earlier head; they do not carry to this head, as the description says.
- Claim: typecheck, lint, format, pre-review and changeset checks pass. Verified for the build typecheck, ESLint (one warning), Prettier, pre-review (no findings) and the changeset check; the knowledge check was not confirmed.
- Claim: the overlapping pull requests merge cleanly. Not checked.
- Changeset: the fix, the callback condition and the long-table impact. Verified.
- File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableCell.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableRow.tsx: clear. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear; the new cases fail onmainwhere the description says so. - File
docs/specs/components/Table/plugins/rowExpansion/useTableRowExpansion.spec.md: owner-approved for this head; the scope-lines note above. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: clear.
| | FR2 | Trim surrounding whitespace. A nonempty result supplies `{label}` to `@astryx.tableRowExpansion.expandRowNamed` or `collapseRowNamed`, according to expansion state. An absent callback or whitespace-only result uses the existing `expandRow` or `collapseRow` message. | DEC-1; internationalization message ownership | Approved; implementation verified separately | | ||
| | FR3 | This module resolves names in the rendered control's translation context; `architecture:internationalization` owns that provider's scope and locale/override updates, including when it surrounds only Table inside the hook's caller. | Internationalization provider boundary | Verification required | | ||
| | FR4 | The row's context-menu action retains generic localized expand/collapse wording. Row labels do not add visible text, alter layout or change control roles, `aria-expanded`, keyboard operation, focus or panel behavior. | Table FR7; additive compatibility | Verification required | | ||
| | FR5 | While a row's panel is open, the panel carries the divider below the row, and the row shows none. | Table FR14 | Verified by row-expansion glide and divider browser checks | |
There was a problem hiding this comment.
Non-blocking: this record's Intent (line 48) says it "contracts only that accessible-name slice of the existing hook", and its Ownership boundary (line 60) lists "panel anatomy" under "Does not own". FR5 here and the known limit on line 88 go beyond both, so a reader who trusts those lines skips them. Widen the two lines to name the divider hand-off and the re-render limit, or move FR5 beside component:Table FR14.
| // The expanded keys live in a store, so a toggle leaves the plugin object | ||
| // as it is and re-renders no row: the chevron, the panel and the glide's | ||
| // measurement each subscribe to the keys they show. The caller's other | ||
| // callbacks stay memo inputs, so a changed callback re-renders the rows. |
There was a problem hiding this comment.
Non-blocking (INV29): this repeats the store's JSDoc at lines 622-627 in one 36-word sentence. Keep only what it adds:
// The caller's other callbacks stay memo inputs, so a changed callback re-renders the rows.| // An open row expansion sets --_table-open-row-divider-width to 0 on | ||
| // its row: its panel carries the divider below the row | ||
| // (plugins/rowExpansion), so the row and its panel read as one unit. |
There was a problem hiding this comment.
Non-blocking (INV29): one 31-word sentence with two topics. For example:
// An open row expansion sets this width to 0 on its row.
// Its panel carries the divider below the row (plugins/rowExpansion).|
/approve-spec 53185b3 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, and it runs once the pull request is marked ready for review.
A toggle now re-renders no other row while the row callbacks keep their identity: on the 2,000-row story a press drops from 2.1–2.3 s to 0.21–0.33 s in Chromium, and the frames match main pixel for pixel. The merge of main changed nothing in this pull request's own files, and the findings from the last review stay fixed.
Non-blocking:
- Miss: the published usage example in
useTableRowExpansion.doc.mjsstill writesgetRowKey,getRowLabelandrenderExpandedinline, so builders who copy it keep rendering every row; hoist them as the JSDoc example does and state the identity condition there. - The module record's Intent and Ownership lines still scope it to accessible names, while FR5 and the new known limit go beyond that (carried; see the inline comment).
- Two description figures predate the merge of
main: the table page now grows 52 B gzip (71 B minified, as stated), Table's unit suites count 951 tests, and #8281 does not merge cleanly in these files.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none; the last review ran under this recipe.
- Claim: a toggle no longer re-renders the other rows while the four row callbacks keep their identity, and
onTogglecan be inline. Verified: the new render-count case fails onmain(40 cell renders) and passes here (0); a press on the 2,000-row story takes 2,120–2,271 ms onmainand 214–327 ms here. - Claim: inline callbacks keep today's behaviour, every row re-rendering. Verified in code: the four callbacks stay memo inputs of the plugin and its column.
- Claim: only the toggled row's chevron and panel update. Verified: each chevron and panel subscribes to its own row's state.
- Claim: a changed row label or expandability result still reaches mounted rows. Verified: the new case passes here, and on
mainas stated. - Claim: what people see and hear is unchanged (chevron, name, panel, divider, glide, row click, context menu). Verified: Table's 951 unit tests and 39 Chromium browser specs pass, and frames of three stories are pixel-identical to
mainwith matching computed dividers. - Claim: a row that renders open hands its divider over in the server markup. Verified: the case fails on
mainand passes here. - Claim: a table nested in an open row keeps its own dividers. Verified in code:
TableRowresets the property on every row. - Claim: the glide's play step runs in the commit that changes the panels. Verified in code and by the glide browser spec.
- Claim: the context-menu action reads the open state when the menu opens. Verified: the menu resolves its actions when it opens.
- Claim: the cause was a plugin memoized over the expanded keys. Verified on
main: a new plugin makes every row render. - Claim: the one post-commit store publish follows the infinite-scroll plugin's precedent. Verified: that plugin publishes from its commit effect only.
- Claim: the table page grows 41 B gzip (71 B minified) and docs, form and menu are unchanged. Partly: 71 B minified and docs, form and menu unchanged hold; gzip is 52 B against the current base, under the 307 B limit.
- Claim: Table's unit suites (941) pass. Verified: all 951 pass at this head, the extra ten from
main. - Claim: the glide, cell-menu, expand-slot, sticky-divider, root-font-size and motion busy and reveal-paint browser specs pass. Verified in Chromium: 14, 6, 1, 18, 6 and 11 passed.
- Claim: the desktop timings before and after. Verified in kind: 2.1–2.3 s on
mainand 0.21–0.33 s here; the heap figures were not reproduced. - Claim: the physical-iPhone results. Stated for an earlier head; they do not carry to this head, as the description says.
- Claim: typecheck, lint, format, knowledge and changeset checks pass. Verified: the Core build's typecheck, ESLint (one warning), Prettier, the knowledge check, the changeset check and the pre-review script (no findings) pass.
- Claim: #11569, #8861 and #8281 merge cleanly with this branch in these files. Partly: #11569 and #8861 do; #8281 conflicts in the plugin, its test and
TableRow, where it already conflicts withmain. - Changeset: the fix, the callback condition and the long-table impact. Verified.
- File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableCell.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableRow.tsx: clear. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear; the new cases fail onmainwhere the description says so. - File
docs/specs/components/Table/plugins/rowExpansion/useTableRowExpansion.spec.md: owner-approved for this head; the scope-lines note above. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: clear.
There was a problem hiding this comment.
Changes requested: the toggle fix still holds, but CI found one failure this pull request causes.
- Found by CI:
TableRow.tsx:101declares the private--_table-open-row-divider-widthwithout registering it, soderivedVarRegistry.test.ts("Table: all source vars are in doc file") fails and thetest-ui (1/4)job is red; add it to that test'sSTRUCTURAL_VARSbeside--_table-row-divider-width, where the other private Table plumbing vars sit.
Non-blocking:
- The published usage example in
useTableRowExpansion.doc.mjsstill writesgetRowKey,getRowLabelandrenderExpandedinline, so builders who copy it keep rendering every row; hoist them as the JSDoc example does. - The module record's Intent and Ownership lines still scope it to accessible names, while FR5 and the known limit go beyond that (see the inline comment).
- The description still says the pull request stays draft until an iPhone re-take; it is now ready, so add the re-take result or drop the line, and refresh the size (52 B gzip), test-count (951) and #8281 overlap lines.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none; the last review ran under this recipe.
- Claim: a toggle no longer re-renders the other rows while the four row callbacks keep their identity, and
onTogglecan be inline. Verified: the new render-count case fails onmain(40 cell renders) and passes here (0); a press on the 2,000-row story takes 2.1–2.3 s onmainand 0.21–0.33 s here. - Claim: inline callbacks keep today's behaviour, every row re-rendering. Verified in code: the four callbacks stay memo inputs of the plugin and its column.
- Claim: only the toggled row's chevron and panel update. Verified: each chevron and panel subscribes to its own row's state.
- Claim: a changed row label or expandability result still reaches mounted rows. Verified: the new case passes here, and on
mainas stated. - Claim: what people see and hear is unchanged. Verified: Table's unit tests and Chromium browser specs pass, and frames of three stories are pixel-identical to
main; the description's 16-state desktop pass was not repeated. - Claim: a row that renders open hands its divider over in the server markup. Verified: the case fails on
mainand passes here. - Claim: a table nested in an open row keeps its own dividers. Verified in code:
TableRowresets the property on every row. - Claim: the glide's play step runs in the commit that changes the panels. Verified in code and by the glide browser spec.
- Claim: the context-menu action reads the open state when the menu opens. Verified: the menu resolves its actions when it opens.
- Claim: the cause was a plugin memoized over the expanded keys. Verified on
main: a new plugin makes every row render. - Claim: the one post-commit store publish follows the infinite-scroll plugin's precedent. Verified: that plugin publishes from its commit effect only.
- Claim: the table page grows 41 B gzip (71 B minified) and docs, form and menu are unchanged. Partly: 71 B minified and the other pages hold; gzip is 52 B against the current base, under the 307 B limit.
- Claim: Table's unit suites (941) pass. Verified for the Table folder, where 951 pass; the Core theming registry test outside it fails (the blocking finding).
- Claim: the glide, cell-menu, expand-slot, sticky-divider, root-font-size and motion busy and reveal-paint browser specs pass. Verified in Chromium: 14, 6, 1, 18, 6 and 11 passed.
- Claim: the desktop timings before and after. Verified in kind; the heap figures were not reproduced.
- Claim: the physical-iPhone results. Stated for an earlier head; they do not carry to this head, as the description says.
- Claim: the pull request stays draft until an iPhone re-take at a head that contains #13181. Out of date: this head contains #13181 and the pull request is ready, with no re-take result stated.
- Claim: typecheck, lint, format, knowledge and changeset checks pass. Verified: CI's typecheck and lint pass at this head.
- Claim: #11569, #8861 and #8281 merge cleanly with this branch in these files. Partly: #11569 and #8861 do; #8281 conflicts, as it already does with
main. - Changeset: the fix, the callback condition and the long-table impact. Verified.
- File
packages/core/src/Table/TableRow.tsx: blocking finding at line 101. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableCell.tsx: clear; one comment suggestion. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear; the new cases fail onmainwhere the description says so. - File
docs/specs/components/Table/plugins/rowExpansion/useTableRowExpansion.spec.md: owner-approved for this head; the scope-lines note above. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: clear.
CI's derived-var check: --_table-open-row-divider-width is read in TableCell but missing from Table.doc.mjs. It is listed as a private var, and exempt from a derived[] mapping: a theme's borderBottomWidth on the row must not write it, or an open row would draw its divider again.
|
/approve-spec def8574 |
There was a problem hiding this comment.
Approved: CI passes on this head.
Non-blocking:
- The published usage example in
useTableRowExpansion.doc.mjsstill writesgetRowKey,getRowLabelandrenderExpandedinline, so builders who copy it keep rendering every row; hoist them as the JSDoc example does. - The module record's Intent and Ownership lines still scope it to accessible names, while FR5 and the known limit go beyond that (see the inline comment).
- The description still says the pull request stays draft until an iPhone re-take at a head that contains #13181, though it is now ready with no re-take result, and its size (+52 B gzip against the base, not +41 B), test-count (951) and #8281 overlap lines are out of date.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none; the last review at this head ran under this recipe.
- Claim: a toggle no longer re-renders the other rows while the four row callbacks keep their identity, and
onTogglecan be inline. Verified: the render-count case passes here (0 cell renders; 40 onmain), and a press on the 2,000-row story takes 2.2–2.5 s onmainand 0.20–0.31 s here. - Claim: inline callbacks keep today's behaviour, every row re-rendering. Verified in code: the four callbacks stay memo inputs of the plugin and its column.
- Claim: only the toggled row's chevron and panel update. Verified: each chevron and panel subscribes to its own row's state.
- Claim: a changed row label or expandability result still reaches mounted rows. Verified: the new case passes here and in CI.
- Claim: what people see and hear is unchanged. Verified: Table's unit tests pass here and in CI, and Chromium frames of two glided panels, an app-overridden divider and the default Table story are pixel-identical to the base; CI's visual gate compares against an older baseline.
- Claim: a row that renders open hands its divider over in the server markup. Verified: the case passes here and fails on
main. - Claim: a table nested in an open row keeps its own dividers. Verified in code:
TableRowresets the property on every row. - Claim: the glide's play step runs in the commit that changes the panels. Verified in code and by the glide unit suite.
- Claim: the context-menu action reads the open state when the menu opens. Verified: the menu resolves its actions when it opens.
- Claim: the cause was a plugin memoized over the expanded keys. Verified on
main: a new plugin makes every row render. - Claim: the one post-commit store publish follows the infinite-scroll plugin's precedent. Verified: that plugin publishes from its commit effect only.
- Claim: the table page grows 41 B gzip (71 B minified) and docs, form and menu are unchanged. Partly: 71 B minified and the other pages hold; gzip is 52 B against the base, under the 0.3 KB limit.
- Claim: Table's unit suites (941) pass. Verified with a different count: 951 pass in the Table folder.
- Claim: the glide, cell-menu, expand-slot, sticky-divider, root-font-size and motion browser specs pass. Verified in Chromium with this head's rendered code, and CI's interaction and accessibility browser suites pass at this head.
- Claim: the desktop timings before and after. Verified in kind; the 4× CPU and heap figures were not reproduced.
- Claim: the physical-iPhone results. Stated for an earlier head; not re-taken at this head.
- Claim: the pull request stays draft until an iPhone re-take at a head that contains #13181. Outdated: this head contains #13181 and the pull request is ready for review with no re-take result stated.
- Claim: no new public API. Verified: the API report and CI's analysis list no added, changed or removed row.
- Claim: public text carries no internal context. Verified.
- Claim: typecheck, lint, format, knowledge and changeset checks pass. Verified for typecheck and the Lint workflow by CI at this head.
- Claim: #11569, #8861 and #8281 merge cleanly with this branch in these files. Partly: #11569 and #8861 do; #8281 conflicts, in the same files where it already conflicts with
main. - Changeset: the fix, the callback condition and the long-table impact. Verified.
- File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clear; one comment suggestion. - File
packages/core/src/Table/TableRow.tsx: clear. - File
packages/core/src/Table/TableCell.tsx: clear; one comment suggestion. - File
packages/core/src/Table/Table.doc.mjs: clear; the private entry matches the code. - File
packages/core/src/theme/derivedVarRegistry.test.ts: clear; passes in CI. - File
packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clear; the new cases pass here and in CI. - File
docs/specs/components/Table/plugins/rowExpansion/useTableRowExpansion.spec.md: owner-approved for this head; the scope-lines note above. - File
.changeset/table-row-expansion-toggle-renders-one-row.md: clear.






User impact
useTableRowExpansion, most of all on a long table (hundreds or thousands of rows that aren't windowed), and on phones.getRowKey,getRowLabel,getIsItemExpandableandrenderExpandedkeep their identity (defined outside the component, or memoized).onTogglecan be written inline. On the same story with stable callbacks (docs(Table): the long-table row-expansion story passes stable callbacks #13181), the press takes 0.27–0.32 s on desktop and 0.54–0.67 s at 4× CPU, and the JS heap doesn't grow (+1 MB instead of +212 MB on the first expansion). A caller that passes those four callbacks inline each render keeps today's behaviour: every row re-renders.mainand with this change alike. It disappears with the glide off. It is tracked separately as a motion defect (AST-105); this change leaves the glide as it is.getRowLabelorgetIsItemExpandableresult still reaches mounted rows.Problem and solution fit
useTableRowExpansionbuilt its plugin object withuseMemooverexpandedKeys. A toggle makes a new Set, so the plugin is new and BaseTable's row comparison renders every row: about 134,000 React fibers per press on the 2,000-row story. The first press also builds React's alternate tree for 128,060 of them, about 212 MB of heap.component:Table, row expansion).The plugin's output for a row depends on which rows are open only through the chevron, the panel and the divider. So the expanded keys move out of the plugin's memo inputs into a small store that those parts subscribe to, and the plugin keeps its identity across a toggle. The caller's other callbacks stay memo inputs, so a changed callback re-renders the rows as before.
onToggleis read through a committed ref, only in event handlers.Expected behavior and authority
useTableInfiniteScroll'sruntime.commit).component:TableFR14 (the row's divider goes to its open panel) and FR15 (the chevron turns on the glide's motion) keep their tests.module:Table/useTableRowExpansiongains FR5: while a row's panel is open, the panel carries the divider below the row, and the row shows none.Smallest restoration
useTableRowExpansion.tsx:expandedKeysafter each commit, before the frame paints.ExpansionChevronCell), the panel (ExpansionPanelRow) and the glide's measurement (ExpansionSnapshotFromStore) subscribe to it. The glide's play step runs in a layout effect of the measurement component, in the same commit as the panel change.onTogglesits behinduseCommittedRef, read in the chevron, row-click and menu handlers. The context-menu action reads the open state when the menu opens.--_table-open-row-divider-width, fromTableCell's divider style. A row that renders open sets it in its own markup, so a server render already draws the divider on the panel. After that, the panel's ref callback sets and clears it on the row, which it finds by key, in the same commit as the panel.TableRowresets it on every row, so a table nested in an open row keeps its own dividers.[fix]changeset.pnpm size:pages, basemain): the table page grows 41 B gzip (+71 B minified); docs, form and menu are unchanged.Evidence
renderCellcalls across a toggle on a 40-row table with stable callbacks. It fails onmain, where every row renders again.renderToStringcase with one row open checks that the open row hands its divider to the panel in the server markup and the closed row doesn't. It fails without the row's own markup.getIsItemExpandableandgetRowLabelresults across a caller re-render. It passes onmain, and it failed with this PR's earlier ref-based version, which this head replaces.glide: false. The first toggle grows the heap from 355 MB to 567 MB.main, at an earlier head with the same divider values: desktop Chromium 12/12 and a physical iPhone 14 4/4 pixel-identical. Index: https://github.com/vjeux/astryx/blob/b5480248e1595c94b1568931c2a0d9bab511f131/index.mdmain(gliding rows with rows, grid, theme, row border and muted panel; the scheme-following divider with and without an override; the detail panel; light and dark): 15 byte-identical. The dark detail panel differs in 6 pixels of the chevron glyph by 1/255.main, and tab resets in 0 of 8 blocks vs 2 of 4.Scope
Components: Table
Testing
vitest run --project ui packages/core/src/Table: 941 passed.playwright test --config=playwright.config.ts --project=chromium: TableRowGlide, TableCellMenus, TableRowExpandSlot, TableStickyDividers and SpacingRootFontSize pass.--config=playwright.interaction.config.ts: animatedLayoutBusy and animatedLayoutRevealPaint pass.tsc, eslint, prettier, review:pre, check:knowledge and check:changesets pass at this head.Overlap checked: #11569, #8861, #8281 (#11569 loads a cell's context menu only when the cell has actions, but the expansion plugin gives every cell an action, so it doesn't stop the all-row render fixed here; #8861 and #8281 add row activation and touch these files elsewhere; each merges cleanly with this branch in these files)