Skip to content

fix(Table): a row expansion toggle re-renders no other row - #13359

Merged
cixzhang merged 8 commits into
mainfrom
l0/table-row-expansion-toggle-one-row
Nov 22, 2026
Merged

cixzhang merged 8 commits into
mainfrom
l0/table-row-expansion-toggle-one-row

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people using a Table with useTableRowExpansion, most of all on a long table (hundreds or thousands of rows that aren't windowed), and on phones.
  • Before: each expand or collapse re-rendered every row of the table. On the 2,000-row story "Gliding Rows Long Table" a press held the page for 1.4–2.9 s on a desktop and 5–9 s at 4× CPU. On a physical iPhone 14 (iOS 26.2) the commit took 1.0–3.3 s, and Safari reset the tab in 2 of 4 fresh-load blocks.
  • After: a press re-renders no other row; only the toggled row's chevron and panel update, while the caller's getRowKey, getRowLabel, getIsItemExpandable and renderExpanded keep their identity (defined outside the component, or memoized). onToggle can 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.
  • Not fixed here: on the iPhone, a ~10–12 s pause between the glide's first and second frames remains in roughly the first 1–3 expansions after a fresh load, on main and 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.
  • Unchanged: what the person sees and hears: the chevron and its accessible name, the panel, the row divider handed to the panel (Table FR14), the glide, row-click expansion and the context-menu action. A changed getRowLabel or getIsItemExpandable result still reaches mounted rows.

Problem and solution fit

  1. Why it occurs: useTableRowExpansion built its plugin object with useMemo over expandedKeys. 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.
  2. Why it harms the task: the press holds the page for seconds, and on iOS the memory spike can make Safari reset the tab, so the person loses their page state.
  3. Why that matters: the toggle's contract is that a press expands or collapses the row (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. onToggle is read through a committed ref, only in event handlers.

Expected behavior and authority

  • The specification ruling on this defect: a press that freezes the page for seconds and makes iOS reset the tab is a defect. The remedy is the smallest internal change with no change to the public plugin protocol, keeping the plugin's identity stable so that only the rows whose state flipped render. The one post-commit publish to the store was accepted (precedent: useTableInfiniteScroll's runtime.commit).
  • component:Table FR14 (the row's divider goes to its open panel) and FR15 (the chevron turns on the glide's motion) keep their tests. 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.

Smallest restoration

  • useTableRowExpansion.tsx:
    • A store holds the expanded keys. One layout effect syncs it with the controlled expandedKeys after each commit, before the frame paints.
    • The chevron (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.
    • onToggle sits behind useCommittedRef, read in the chevron, row-click and menu handlers. The context-menu action reads the open state when the menu opens.
  • The divider hand-off: an open row's cells read a private custom property, --_table-open-row-divider-width, from TableCell'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. TableRow resets it on every row, so a table nested in an open row keeps its own dividers.
  • A [fix] changeset.
  • First-load size (pnpm size:pages, base main): the table page grows 41 B gzip (+71 B minified); docs, form and menu are unchanged.

Evidence

  • Reproduction before the change:
    • A unit case counts a column's renderCell calls across a toggle on a 40-row table with stable callbacks. It fails on main, where every row renders again.
    • A renderToString case 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.
    • A case changes getIsItemExpandable and getRowLabel results across a caller re-render. It passes on main, and it failed with this PR's earlier ref-based version, which this head replaces.
    • Desktop Chromium on the 2,000-row story: each toggle is one 1.4–2.9 s task (5.3–9.2 s at 4× CPU), the same with glide: false. The first toggle grows the heap from 355 MB to 567 MB.
  • Result after the change: all three cases pass. With docs(Table): the long-table row-expansion story passes stable callbacks #13181's stable story callbacks, the toggle task is 0.27–0.32 s at 1× and 0.54–0.67 s at 4× CPU (in-page click), and the heap stays at 361 MB over the toggles.
  • Representative unchanged paths: Table's unit suites (941) pass. These browser specs pass: the glide (TableRowGlide 14/14), cell menus (6/6), expand slot, sticky dividers (18/18), root font size, and the motion module's busy and reveal-paint specs.
  • No visual change:
  • Physical iPhone (AST-013 FR10):

Scope

Components: Table

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

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.
  • Core 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)

… 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.
@cixzhang cixzhang added ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) lane:0 Astryx fix-loop lane 0 owns this labels Nov 21, 2026
@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 22, 2026 1:30am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 22, 2026, 2:50 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 21, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec c9d2390

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · def8574

Storybook · Sandbox · built from this PR's head

Modified components

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.

Component · story Before After Diff
Table · Default (neutral, dark) · same image also changed on another pull request, not proven from main before frame after frame diff frame
Table · Default (neutral, light) · same image also changed on another pull request, not proven from main before frame after frame diff frame

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = config during render and rows read that ref while rendering (useTableRowExpansion.tsx:806-807, :1060-1068, :1113-1116, :1196-1199), which react-component-runtime INV17 and INV3 forbid, so put onToggle behind useCommittedRef for the handlers and read the render-time callbacks as values (memo inputs, or through the store the chevron and panel already subscribe to).
  • Changed getIsItemExpandable or getRowLabel results never reach mounted rows: a memoized getIsItemExpandable that turns false leaves every chevron in place and a click still opens a panel on that row, and a changed getRowLabel keeps the old accessible names, where main updates 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 main and 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.

Automated review (maintainer link)

… 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.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7b82f72

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
…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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9d8e0aa

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = config during render and rows read that ref while rendering (useTableRowExpansion.tsx:816-817, :1072-1080, :1125-1128, :1208-1211), which react-component-runtime INV17 and INV3 forbid, so put onToggle behind useCommittedRef for the handlers and read the render-time callbacks as values (memo inputs, or through the store the chevron and panel already subscribe to).
  • Changed getIsItemExpandable or getRowLabel results never reach mounted rows: a memoized getIsItemExpandable that turns false leaves every chevron in place and a click still opens a panel on that row, and a changed getRowLabel keeps the old accessible names, where main updates 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, which public-component-api DEC-2 and the repository's AGENTS.md rule 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 main and 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 main and 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.

Automated review (maintainer link)

… 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.
@cixzhang cixzhang changed the title fix(Table): a row expansion toggle re-renders only that row's chevron and panel fix(Table): a row expansion toggle re-renders no other row Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/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.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec deed3d1

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 onToggle can be inline. Verified: the new render-count test fails on main (40 cell renders) and passes here (0), and an inline-onToggle probe 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 main as 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 main with matching computed dividers.
  • Claim: a row that renders open hands its divider over in the server markup. Verified: the test fails on main and passes here.
  • Claim: a table nested in an open row keeps its own dividers. Verified in code: TableRow resets 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 on main where 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.

Automated review (maintainer link)

| 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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +838 to +841
// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +165 to +167
// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 53185b3

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs still writes getRowKey, getRowLabel and renderExpanded inline, 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 onToggle can be inline. Verified: the new render-count case fails on main (40 cell renders) and passes here (0); a press on the 2,000-row story takes 2,120–2,271 ms on main and 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 main as 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 main with matching computed dividers.
  • Claim: a row that renders open hands its divider over in the server markup. Verified: the case fails on main and passes here.
  • Claim: a table nested in an open row keeps its own dividers. Verified in code: TableRow resets 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 main and 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 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/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 on main where 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.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the toggle fix still holds, but CI found one failure this pull request causes.

  • Found by CI: TableRow.tsx:101 declares the private --_table-open-row-divider-width without registering it, so derivedVarRegistry.test.ts ("Table: all source vars are in doc file") fails and the test-ui (1/4) job is red; add it to that test's STRUCTURAL_VARS beside --_table-row-divider-width, where the other private Table plumbing vars sit.

Non-blocking:

  • The published usage example in useTableRowExpansion.doc.mjs still writes getRowKey, getRowLabel and renderExpanded inline, 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 onToggle can be inline. Verified: the new render-count case fails on main (40 cell renders) and passes here (0); a press on the 2,000-row story takes 2.1–2.3 s on main and 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 main as 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 main and passes here.
  • Claim: a table nested in an open row keeps its own dividers. Verified in code: TableRow resets 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 on main where 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.

Automated review (maintainer link)

Comment thread packages/core/src/Table/TableRow.tsx Resolved
@cixzhang
cixzhang marked this pull request as draft November 22, 2026 01:19
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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec def8574

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: CI passes on this head.

Non-blocking:

  • The published usage example in useTableRowExpansion.doc.mjs still writes getRowKey, getRowLabel and renderExpanded inline, 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 onToggle can be inline. Verified: the render-count case passes here (0 cell renders; 40 on main), and a press on the 2,000-row story takes 2.2–2.5 s on main and 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: TableRow resets 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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 22, 2026 02:16
github-actions Bot added a commit that referenced this pull request Nov 22, 2026
@cixzhang
cixzhang merged commit 77f7f35 into main Nov 22, 2026
158 checks passed
@github-actions
github-actions Bot deleted the l0/table-row-expansion-toggle-one-row branch November 22, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — def85740 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. lane:0 Astryx fix-loop lane 0 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant