Repository navigation
Conversation
Port of #8403 onto current main. Cells without `contextMenuActions` no longer import ContextMenu. A cell with actions renders a shared trigger around its content and loads only the menu beside it, so the content keeps its node, focus and state across the load. Co-authored-by: Royi Hagigi <royi@fb.com>
A cell before its menu loads now holds the touch events of a press and hands them to the menu's own long press when it attaches, instead of running a long-press recognizer itself. The pre-load listeners recognize no gesture. The menu times the press from the touch's own start. Also lists the cell trigger and the gesture counter as base modules in the import-boundary check, removes the Table menu crossing from its allowlist, and names when a cell with actions starts the menu load.
…the external-trigger mode exist; keep CI-measured sizes
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 1d8278c |
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
…ord links these files
|
/approve-spec c54e3f0 |
There was a problem hiding this comment.
Request changes. Loading the cell menu lazily works, and the size win checks out: import {Table} drops from 357,792 to 137,952 minified bytes, and its eager chunks hold no menu module. Two parts of the early-invocation and failure paths do not yet follow architecture:component-import-boundaries:
- A held touch loses its earlier moves (INV4):
holdTouchEvent(TableCellContextMenu.tsx:164-167) keeps only the last move, so a press that strays past the 10 px tolerance and comes back before the menu loads opens the menu on replay, while the same press on a loaded cell opens nothing; hold every move and add that sequence to the touch tests. - A failed load is silent in development (INV6): the catch at
TableCellContextMenu.tsx:89-91(and the preload and retry catches) swallows the error, but INV6 says development builds warn once; callwarnOncefromutils/devWarningthere and assert it once in the load-failure test.
Also, when heavy CI runs, refresh the boundaries record's "Table carries 123.5 KB eager" line from the check's printout.
Claims and files checked
Claims (changeset and description):
- Cells load the menu only when they have actions: verified (
TableCellContextMenureturns the content untouched without actions; no-load test). - A table without menus no longer ships ContextMenu, DropdownMenu's menu code and the touch sheet, about 358 KB to 138 KB minified: verified (357,792 to 137,952 bytes; no menu module in the eager chunks). The gzip figures depend on how chunks are compressed and were not reproduced exactly.
- A cell with actions renders its content at once, starts loading on its first client render, and keeps the content's node, focus and state: verified (hydration gate; content-survives tests for body and header cells).
- An early right-click, Shift+F10 or long press is held and opens the menu once it loads unless another press or key comes first, with the browser menu kept shut: verified for right-click and Shift+F10; a held touch can also open the menu after a press that strayed past the tolerance (finding above).
- A failed load keeps the table, returns the browser menu, and a later mount, right-click or touch retries: verified (load-failure tests); no development warning (finding above).
- Tests that expect the menu synchronously after render must wait for it: verified (warm-up helper added to Core's suites).
resolveContextActionskeeps its export and no longer pulls the menu in: verified (Table/index.tsre-exports it fromtableContextActions.ts).- No public API change, no new props, exports or data attributes: verified (generated API surface has no row).
- Action getters still resolve when the menu opens: verified (getter path, row-expansion and sortable tests).
- A loaded menu behaves as before: verified (ContextMenu, DropdownMenu and Table menu suites pass).
- The measured Table and ContextMenu minified sizes: verified exactly; the Markdown and root-entry rows were not re-measured.
- The cell's listeners recognize no gesture before the menu loads: verified (no long-press detector before load).
- A held touch is handed to the loaded detector as its raw events, in order, timed from the touch's start: partly false; consecutive moves collapse to the last one, though timing from the start holds.
- Modules in the lazy graph import Core modules directly: verified (single-bundle test passes).
- Each ContextMenu item alias has its own module: verified.
- The boundary check lists the trigger and gesture-counter modules as base code and drops the Table row: verified (script, its test and the record).
- The menu stays out of server markup and the hydrating render: verified (SSR test over three server renders).
- The two new cell Effects name what they sync: verified.
Files (48):
Table/TableCellContextMenu.tsx: the two findings above.ContextMenu/ContextMenu.tsx,ContextMenuTrigger.tsx,index.tsand the seven alias modules: clear.Table/TableCell.tsx,TableHeaderCell.tsx,tableContextActions.ts,tableContextMenu.tsx,index.ts, and the row-expansion and sortable plugin sources: clear.- The four
DropdownMenuimport edits: clear. - The changeset: clear apart from the touch case above.
- The three records: clear apart from the eager-size line.
- The three boundary and bundle scripts and the shared-identity baseline: clear.
- The 18 test, fixture and helper files: clear.
|
/revoke-spec |
Keeps the lazy cell menu. From main: the header's unpositioned menu trigger, with points measured from the anchor's containing block, a held right-click included; the predicate's one name, hasContextActions; the touch sheet's lazy action list; the sub-menu's visibleText. The boundaries record takes main's tables without the cell-menu row, adds the cell wrapper's gesture-counter crossing, and the check's current costs.
…ns once in development A press that strayed past the move tolerance and came back before the menu loaded opened the menu on replay, because only the last move was held. Every move is held now, so the replay cancels it as a loaded cell does. A failed load of the menu code warns once in development builds, from whichever path saw it first.
|
/approve-spec b190355 |
|
/approve-spec fd87ad2 |
There was a problem hiding this comment.
Request changes. The lazy cell menu holds up at this head: the table page's first-load JavaScript drops by about 25 KB gzip, a loaded menu renders the same as on main, a held touch now keeps every move, and a failed load warns once in development. Two things still need fixing:
- The boundary check's allowlist test fails:
scripts/check-component-import-boundaries.test.mjs:390-410still expects four rows, but the record's allowlist now hasTable/TableCellContextMenu → Layer/gestureCounter(docs/architecture/component-import-boundaries.md:223), so add that row after theLink/Linkentry. - The description lists a record edit that is not in the diff: it says the truncation-tooltip sentence no longer says it costs Table nothing, but
component-import-boundaries.md:229-231still says so (unchanged, and still accurate), so drop that clause from the description.
Also, the INV7 gap bullet at component-import-boundaries.md:270-271 still says 3.6 KB where the allowlist row now says 3.5 KB.
Claims and files checked
Review mode: full; reason: spec-record
Claims (changeset and description):
- Cells load the menu only when they have actions: verified (
TableCellContextMenureturns the content untouched without actions; the no-load test). - A table without menus no longer ships the menu code, about 23 to 25 KB less first-load gzip for a Table, Text and Button page: verified with the repository's esbuild page measure (25,618 B less gzip); the Vite, Rolldown and webpack figures were not reproduced.
- About 21 % less first-load JavaScript on that page, and about 0.35 KB more on the menu page: verified with the same measure (21.7 % less; menu page 367 B more gzip).
- A cell with actions renders its content at once, starts loading on its first client render after hydration, and keeps the content's node, focus and state: verified (hydration gate; body- and header-cell tests; pixel-identical frames at rest).
- An early right-click, Shift+F10 or long press is held and opens the menu once unless another press or key comes first, with the browser menu kept shut: verified (14 touch tests, the held right-click and Shift+F10 tests).
- A failed load keeps the table, drops the hold, returns the browser menu, warns once in development, and a later mount or invocation retries: verified (load-failure tests).
- A test that expects the menu synchronously right after render has to wait for it: verified (the warm-up helper in four suites).
resolveContextActionskeeps its export and no longer pulls the menu in: verified (Table/index.tsre-exports it fromtableContextActions.ts).- No public API change, no new props, exports or data attributes: verified (the generated surface of build, core and the seven themes has no row).
- Action getters still resolve when the menu opens, and a loaded menu behaves as before: verified (getter path, row-expansion and sortable tests; pixel-identical menu frames).
- The trigger module and the internal trigger mode are shared and not exported publicly: verified (
ContextMenu/index.tsand the package exports map). - The cell recognizes no gesture before load, and a held touch reaches the loaded detector in order, timed from its start: verified (no-detector test; deadline test).
- Modules in the lazy graph import Core modules directly, and the seven item aliases have their own modules: verified (single-bundle test passes; seven alias files).
- The boundary check lists the two base modules and drops the old Table row: verified (script and record).
- The esbuild page figures for the table and menu pages: verified (minified deltas match exactly; gzip within a few hundred bytes).
- The boundary check passes and prints about 50.5 KB eager for Table: verified (passes; 50.7 KB locally, within the record's stated tolerance).
- The listed record edits (base-code list, removed row and gap bullet, PR1, verified_by, Owns lines, FR10 note): verified.
- The truncation-tooltip sentence no longer says it costs Table nothing: false (finding above).
- 72 files and 1,388 tests pass in the Table, ContextMenu and DropdownMenu suites: verified (same counts).
- The touch and load-failure tests added in the last round: verified.
- The boundary-check and single-bundle node tests pass: false; the allowlist test fails (finding above).
- One new allowlist row at 0.0 KB: verified (check printout).
- Typecheck, ESLint and Prettier pass: verified; the knowledge and changeset checks were not run.
- The Chromium cases pass locally: not run here; CI has not run on this draft head.
- Overlap and land-path notes: process information, not a code claim.
Files (49):
Table/TableCellContextMenu.tsx: the earlier findings are fixed; one comment-style suggestion.scripts/check-component-import-boundaries.test.mjs: stale allowlist expectation (finding above).docs/architecture/component-import-boundaries.md: clear apart from the INV7 gap figure.ContextMenu/ContextMenu.tsx,ContextMenuTrigger.tsx,index.ts, the seven alias modules andContextMenu.test.tsx: clear.Table/TableCell.tsx,TableHeaderCell.tsx,tableContextMenu.tsx,tableContextActions.ts,index.tsand the row-expansion and sortable plugin sources: clear.- The four
DropdownMenuimport edits: clear. - The ContextMenu and TableCell records and the changeset: clear.
scripts/check-component-import-boundaries.mjs,scripts/core-single-bundle.test.mjsand the shared-identity baseline: clear.- The 18 other test, fixture and helper files: clear.
…er's gesture-counter row The record's INV7 gap note takes the check's 3.5 KB, and a comment splits into short sentences.
…t the stale-row test
|
/approve-spec defaf5b |
There was a problem hiding this comment.
Request changes. The lazy cell menu holds up at this head. The table page's first-load JavaScript drops by about 25 KB gzip, the earlier findings are fixed, and the Chromium early-invocation, box and axe cases pass. One thing still needs fixing:
- Miss: Header cells start loading the menu code right after hydration, and every sortable column gives its header cell actions, but
architecture:component-import-boundariesINV2 allows a load before intent only at a moment the component's own record names, andcomponent:TableHeaderCellnames none (component:TableCellPR1 covers body cells only), so add that moment to theTableHeaderCellrecord and have an engineering owner approve that head with/approve-spec <full head SHA>, or start the header cell's load on intent.
Claims and files checked
Review mode: same-head; reason: none
Claims (changeset and description):
- Cells load the menu only when they have actions: verified (the cell wrapper returns its content untouched without actions; the no-load test).
- A table without menus no longer ships the menu code and the touch sheet, about 23 to 25 KB less first-load gzip for a Table, Text and Button page in Vite, Rolldown and webpack: verified with the repository's esbuild page measure (25,623 B less gzip, about 21.7 %); the three bundler figures were not reproduced.
- The menu page grows about 0.35 KB, and the docs and form pages do not change: verified (menu page 367 B more gzip; docs and form unchanged).
- The static-graph figures for the table and menu pages: verified within 0.2 KB, the platform tolerance the record states.
- A cell with actions renders its content at once, starts loading on its first client render after hydration, and keeps the content's node, focus and state: verified (the hydration gate; the body- and header-cell tests).
- An early right-click, Shift+F10 or long press is held and opens the menu once unless another press or key comes first, with the browser menu kept shut: verified (14 touch tests; the three early-invocation Chromium cases).
- A failed load keeps the table, drops the hold, returns the browser menu, warns once in development, and a later mount or invocation retries: verified (load-failure tests).
- A test that expects the menu synchronously right after render has to wait for it: verified (the warm-up helper in four suites).
resolveContextActionskeeps its export and no longer pulls the menu in: verified (the Table index re-exports it from the new helper module).- No public API change, no new props, exports or data attributes: verified (the generated surface of build, core and the seven themes has no row).
- Action getters still resolve when the menu opens, and a loaded menu behaves as before: verified (getter path; row-expansion and sortable tests; the loaded-menu Chromium case).
- The trigger module and the internal trigger mode are shared and not exported publicly: verified (the ContextMenu index and the package exports map).
- The cell recognizes no gesture before load, and a held touch reaches the loaded detector in order, timed from its start: verified (the no-detector test; the deadline test).
- Modules in the lazy graph import Core modules directly, and the seven item aliases have their own modules: verified (the single-bundle test passes; seven alias files).
- The boundary check lists the two base modules and drops the stale Table row, with one new allowlist row at 0.0 KB: verified (script, record and printout).
- The boundary check passes and prints about 50.5 KB eager for Table: verified (passes; 50.7 KB locally, within the stated tolerance).
- The records cover each load path: verified for body cells; false for header cells (finding above).
- The red-first detector test fails on the earlier port: the test exists and passes here; the earlier port was not run.
- The listed record edits (base-code list, removed row and gap bullet, new row, refreshed costs, PR1 and its verification row, verified_by, Owns lines, FR10 note): verified.
- 72 files and 1,388 tests pass in the Table, ContextMenu and DropdownMenu suites: verified (same counts).
- 14 touch tests, and the load-failure test asserts one development warning: verified.
- The boundary-check and single-bundle node tests pass: verified.
- The Chromium cases pass, with Shift+F10 left to a Linux run: verified (all four pass in headless Chromium on Linux, Shift+F10 included).
- Typecheck, ESLint, Prettier, the knowledge check and the changeset check pass: verified.
- Overlap and land-path notes: process information, not a code claim.
Files (49):
Table/TableHeaderCell.tsx: the header-cell load moment (finding above).Table/TableCellContextMenu.tsx,TableCell.tsx,tableContextMenu.tsx,tableContextActions.ts,index.tsand the row-expansion and sortable plugin sources: clear.ContextMenu/ContextMenu.tsx,ContextMenuTrigger.tsx,index.ts, the seven alias modules andContextMenu.test.tsx: clear.- The four
DropdownMenuimport edits: clear. - The import-boundaries, TableCell and ContextMenu records and the changeset: clear.
- The boundary-check script and its test, the single-bundle test and the shared-identity baseline: clear.
- The 18 other test, fixture and helper files: clear.
…s starts its menu load, as TableCell PR1 does
|
/approve-spec 9951ddf |
There was a problem hiding this comment.
Request changes. The lazy cell menu holds up at this head, and the description now lists every changed record. One fix is needed because main has moved:
- Regression:
docs/specs/components/Table/TableHeaderCell.spec.mdconflicts withmain, where #12175 rewrote PR1 to give the header cell its cut-heading tooltip state ("Its only state is FR2's cut-heading tooltip") and added anFR2 tooltipverification row, while this head's PR1 still says the cell "holds no state"; mergemain, keep that state sentence and row, and add the menu-load sentence and the early Shift+F10 row.
The merge is a new commit, so an engineering owner then records the spec decision for the new head by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- Cells load their context menu only when they have actions: verified (the cell wrapper returns plain content without actions; no-load test).
- A table page without actions loads about 23 to 25 KB less first-load gzip: consistent (the table reference page drops by about 25 KB in an esbuild build of both trees; the Vite, Rolldown and webpack matrix was not rerun).
- A cell with actions renders its content at once and starts the load on its first client render after hydration: verified (wrapper render path; hydration test).
- Content keeps its node, focus and state, and the trigger box does not move, when the menu attaches: verified (body and header scenario tests; Chromium box test).
- An early right-click, Shift+F10 or long press is held, opens once on load, is dropped by a later press or key, and the browser menu stays shut: verified (touch tests, Chromium cases).
- A touch before load is held as raw events and timed from its own start by the loaded menu's detector; the cell runs no recognizer: verified (touch tests with a detector spy).
- A failed load keeps the table, returns the browser menu, warns once in development, and retries on a later mount, right-click or touch: verified (load-failure tests).
- Tests that expect the menu synchronously right after render must wait: true.
resolveContextActionskeeps its export and no longer reaches the menu; action getters still resolve on open: verified.- No public API change, no new props, exports or data attributes: verified (generated API surface: no row).
- The trigger module carries no menu code and neither new module is public: verified.
- The lazily loaded graph imports Core modules directly and each ContextMenu alias has its own module: verified (single-bundle test passes; seven alias modules).
- The boundary check lists the two base modules, drops the stale Table row and adds one row at 0.0 KB: verified (check and its tests pass).
- The interaction work sits in callbacks and the added Effects name the system they sync: true (the description counts the cell's two; ContextMenu's two new layout Effects name theirs too).
- The lazy menu stays out of server markup and the hydrating render: verified.
- The static page-graph and boundary-check figures: consistent (table about −25.6 KB and menu about +0.37 KB gzip; Table eager matches the record within its platform note).
- Fourteen touch tests and the Chromium box, axe and first right-click case: verified.
- Records changed are the import-boundaries, TableCell, ContextMenu and TableHeaderCell records, with their rubric results: verified.
- Overlap and land-order statements: process claims, not checked against code.
Files:
.changeset/table-cell-lazy-context-menu.md: cleardocs/architecture/component-import-boundaries.md: cleardocs/specs/components/ContextMenu/ContextMenu.spec.md: cleardocs/specs/components/Table/TableCell.spec.md: cleardocs/specs/components/Table/TableHeaderCell.spec.md: conflicts withmain; its PR1 contradictsmain's PR1 (the finding above)packages/core/src/ContextMenu/ContextMenu.test.tsx: clearpackages/core/src/ContextMenu/ContextMenu.tsx: clearpackages/core/src/ContextMenu/ContextMenuCheckboxItem.ts: clearpackages/core/src/ContextMenu/ContextMenuDivider.ts: clearpackages/core/src/ContextMenu/ContextMenuGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuItem.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioItem.ts: clearpackages/core/src/ContextMenu/ContextMenuSubMenu.ts: clearpackages/core/src/ContextMenu/ContextMenuTrigger.tsx: clearpackages/core/src/ContextMenu/index.ts: clearpackages/core/src/DropdownMenu/DropdownMenuDivider.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuItem.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clearpackages/core/src/DropdownMenu/renderDropdownItems.tsx: clearpackages/core/src/Table/TableCell.tsx: clearpackages/core/src/Table/TableCellContextMenu.loadFailure.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.modality.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.ssr.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.touch.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.tsx: clearpackages/core/src/Table/TableHeaderCell.tsx: clearpackages/core/src/Table/TableHeaderCellContextMenu.test.tsx: clearpackages/core/src/Table/TableMenuWindowFocus.test.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.a11y.chromium.spec.ts: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.client.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.fixture.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.html: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.server.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.vite.mjs: clearpackages/core/src/Table/__tests__/menuLoadScenario.tsx: clearpackages/core/src/Table/__tests__/warmTableContextMenu.tsx: clearpackages/core/src/Table/index.ts: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.test.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.tsx: clearpackages/core/src/Table/tableContextActions.ts: clearpackages/core/src/Table/tableContextMenu.test.tsx: clearpackages/core/src/Table/tableContextMenu.tsx: clearscripts/check-component-import-boundaries.mjs: clearscripts/check-component-import-boundaries.test.mjs: clearscripts/core-single-bundle.test.mjs: clearscripts/shared-identity.baseline.json: clear
…xt-menu TableHeaderCell PR1 keeps main's cut-heading tooltip state (FR2) and adds the menu-load sentence; the verification map keeps main's FR2 tooltip row and this branch's early Shift+F10 PR1 row.
|
/approve-spec f57e833 |
There was a problem hiding this comment.
Request changes. The lazy cell menu holds up at this head, and the merge of main kept the header cell's tooltip state in its record. One fix is left, in the description:
- The Writing rubric results say
component:TableHeaderCellPR1 leaves the header cell with no state ("the cell still holds no state"), but at this head PR1 keeps FR2's cut-heading tooltip as the cell's only state (docs/specs/components/Table/TableHeaderCell.spec.md:129-130); correct that line.
A description edit needs no new commit, so the spec approval recorded for this head stays valid.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- A page whose Table cells have no actions no longer downloads the context menu: verified (the cell wrapper returns plain content without actions; no-load test; table reference page down 25,596 bytes gzip).
- Table, TableCell and TableHeaderCell imports used to pull in ContextMenu, DropdownMenu's menu code and the touch sheet: verified (the base allowlist row and boundary printout).
- About 23 to 25 KB less first-load gzip in Vite, Rolldown and webpack, about 21 %: consistent (an esbuild build of both trees measures 25.0 KB less; the bundler matrix was not rerun).
- A cell with actions renders its content and trigger at once and starts the load on its first client render after hydration: verified (wrapper render path; server-render and hydration test).
- Content keeps its node, focus and state, and the trigger box does not move, when the menu attaches: verified (body and header scenario tests; Chromium box case).
- An early right-click, Shift+F10 or long press is held and opens once on load unless a press or key comes first, and the browser menu stays shut: verified (touch tests; Chromium cases).
- A failed load keeps the table, drops the hold, returns the browser menu, and a later mount or invocation asks the loader again: verified (load-failure tests).
- No public API change, no new props, exports or data attributes; getters resolve when the menu opens; a loaded menu behaves as before: verified (generated API surface has no row; getter path; suites pass).
- The action helpers move to a dependency-free module and the public export is unchanged: verified.
- The trigger module is shared by ContextMenu and the cell, the cell lazy-loads only the menu through the internal mode and the shared loader, and neither module is public: verified.
- Before the menu attaches the cell recognizes no gesture, holds a right-click as a point and a touch as raw events, and the loaded detector times the press from the touch start: verified (detector-spy and deadline tests).
- The lazily loaded graph imports Core modules directly and each ContextMenu alias has its own module: verified (single-bundle test; seven alias modules).
- The boundary check lists the two base modules and the stale Table row is removed: verified.
- The cited authority, including the two Effects the cell adds naming the system they sync: verified (ContextMenu's two new layout Effects name theirs too).
- First-load and static-graph byte figures: consistent (esbuild here: table down 25,596 bytes, menu up 372 bytes, docs and form unchanged).
- The boundary check passes and the record carries its Table eager figure: the check passes; the local printout differs from CI's on unchanged rows too, and CI has not run at this head.
- The behavior tests listed (no recognizer before load, held press deadline, moved press, dropped hold, ported cases, Chromium box and axe): verified (present and passing).
- Not covered: WebKit, a failed chunk in a real browser, focus-ring pixels: true.
- Records changed and their rubric results: verified, except the header-cell line below.
- The header-cell record's PR1 leaves the cell with no state: false (its PR1 keeps the cut-heading tooltip as the cell's only state).
- The Table, ContextMenu and DropdownMenu suites pass: verified (73 files, 1,404 tests at this head, after the latest merge of main).
- The new cell-menu tests (14 touch tests, one development warning), the node boundary and single-bundle tests, and the boundary check pass: verified.
- The Chromium cases pass, and Shift+F10 needs a Linux run: verified (all four pass in headless Chromium on Linux, Shift+F10 included).
- Typecheck, ESLint, Prettier, the knowledge-record check and the changeset check pass: verified (each exits 0 at this head).
- Overlap and land order: process statements, not checked against code.
- The release note (lazy only with actions; the saving; content at once; node, focus and state kept; early invocation held; failure fallback and retry; tests must wait; the helper export stays): verified, sizes consistent.
Files:
.changeset/table-cell-lazy-context-menu.md: cleardocs/architecture/component-import-boundaries.md: cleardocs/specs/components/ContextMenu/ContextMenu.spec.md: cleardocs/specs/components/Table/TableCell.spec.md: cleardocs/specs/components/Table/TableHeaderCell.spec.md: clear; the description misstates its PR1 (the finding above)packages/core/src/ContextMenu/ContextMenu.test.tsx: clearpackages/core/src/ContextMenu/ContextMenu.tsx: clearpackages/core/src/ContextMenu/ContextMenuCheckboxItem.ts: clearpackages/core/src/ContextMenu/ContextMenuDivider.ts: clearpackages/core/src/ContextMenu/ContextMenuGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuItem.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioItem.ts: clearpackages/core/src/ContextMenu/ContextMenuSubMenu.ts: clearpackages/core/src/ContextMenu/ContextMenuTrigger.tsx: clearpackages/core/src/ContextMenu/index.ts: clearpackages/core/src/DropdownMenu/DropdownMenuDivider.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuItem.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clearpackages/core/src/DropdownMenu/renderDropdownItems.tsx: clearpackages/core/src/Table/TableCell.tsx: clearpackages/core/src/Table/TableCellContextMenu.loadFailure.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.modality.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.ssr.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.touch.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.tsx: clearpackages/core/src/Table/TableHeaderCell.tsx: clearpackages/core/src/Table/TableHeaderCellContextMenu.test.tsx: clearpackages/core/src/Table/TableMenuWindowFocus.test.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.a11y.chromium.spec.ts: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.client.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.fixture.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.html: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.server.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.vite.mjs: clearpackages/core/src/Table/__tests__/menuLoadScenario.tsx: clearpackages/core/src/Table/__tests__/warmTableContextMenu.tsx: clearpackages/core/src/Table/index.ts: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.test.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.tsx: clearpackages/core/src/Table/tableContextActions.ts: clearpackages/core/src/Table/tableContextMenu.test.tsx: clearpackages/core/src/Table/tableContextMenu.tsx: clearscripts/check-component-import-boundaries.mjs: clearscripts/check-component-import-boundaries.test.mjs: clearscripts/core-single-bundle.test.mjs: clearscripts/shared-identity.baseline.json: clear
There was a problem hiding this comment.
Approved pending CI. CI has not run on this head yet, so the required checks still have to pass before it merges. The description's Writing rubric line for the header-cell record now matches the record, which was the last open finding, and nothing else blocks.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- A page whose Table cells have no actions no longer downloads the context menu: verified (the cell wrapper returns plain content without actions; no-load test; table reference page down 25,596 bytes gzip).
- Table, TableCell and TableHeaderCell imports used to pull in ContextMenu, DropdownMenu's menu code and the touch sheet: verified (the base allowlist row and the base cell imports).
- About 23 to 25 KB less first-load gzip in Vite, Rolldown and webpack, about 21 %: consistent (an esbuild build of both trees measures 25.0 KB less, 21.4 %; the bundler matrix was not rerun).
- A cell with actions renders its content and trigger at once and starts the load on its first client render after hydration: verified (the lazy menu renders only once hydration is over; server-render and hydration test).
- Content keeps its node, focus and state, and the trigger box does not move, when the menu attaches: verified (body and header scenario tests; Chromium box case).
- An early right-click, Shift+F10 or long press is held and opens once on load unless a press or key comes first, and the browser menu stays shut: verified (touch tests; Chromium cases).
- A failed load keeps the table, drops the hold, returns the browser menu, and a later mount or invocation asks the loader again: verified (load-failure tests).
- No public API change, no new props, exports or data attributes; getters resolve when the menu opens; a loaded menu behaves as before: verified (generated API surface has no row; getter path; suites pass).
- The action helpers move to a dependency-free module and the public export is unchanged: verified.
- The trigger module is shared by ContextMenu and the cell, the cell lazy-loads only the menu through the internal mode and the shared loader, and neither module is public: verified (no exports entry reaches them).
- Before the menu attaches the cell recognizes no gesture, holds a right-click as a point and a touch as raw events, and the loaded detector times the press from the touch start: verified (detector-spy and deadline tests).
- The lazily loaded graph imports Core modules directly and each ContextMenu alias has its own module: verified (single-bundle test; seven alias modules).
- The boundary check lists the two base modules and the stale Table row is removed: verified.
- The cited authority, including the two Effects the cell adds naming the system they sync: verified (ContextMenu's two new layout Effects name theirs too).
- First-load and static-graph byte figures, and the 7 requests under Rolldown: consistent (esbuild here: table down 25,596 bytes, menu up 372 bytes, docs and form unchanged); the bundler figures were not rerun.
- The boundary check passes and the record carries its Table eager figure: the check passes here; its local printout (51.9 KB) differs from the record's CI figure (50.5 KB), and CI has not run at this head.
- The behavior tests listed (no recognizer before load, held press deadline, moved and strayed presses, dropped hold, ported cases, Chromium box and axe): verified (present and passing).
- Not covered: WebKit, a failed chunk in a real browser, focus-ring pixels: true.
- Records changed and their rubric results, including the header-cell record keeping the cut-heading tooltip as its only state: verified.
- The Table, ContextMenu and DropdownMenu suites pass after merging main: verified (73 files, 1,404 tests at this head; the stated 72 files and 1,388 tests predate the latest merge of main).
- The new cell-menu tests (14 touch tests, one development warning), the node boundary and single-bundle tests, and the boundary check pass: verified.
- The Chromium cases pass, and Shift+F10 needs a Linux run: verified (all four pass in headless Chromium on Linux, Shift+F10 included).
- Typecheck, ESLint, Prettier, the knowledge-record check and the changeset check pass: verified (each exits 0 at this head).
- Overlap and land order: process statements, not checked against code.
- The release note (lazy only with actions; the saving; content at once; node, focus and state kept; early invocation held; failure fallback and retry; tests must wait; the helper export stays): verified, sizes consistent.
Files:
.changeset/table-cell-lazy-context-menu.md: cleardocs/architecture/component-import-boundaries.md: cleardocs/specs/components/ContextMenu/ContextMenu.spec.md: cleardocs/specs/components/Table/TableCell.spec.md: cleardocs/specs/components/Table/TableHeaderCell.spec.md: clear; the description now matches its PR1packages/core/src/ContextMenu/ContextMenu.test.tsx: clearpackages/core/src/ContextMenu/ContextMenu.tsx: clearpackages/core/src/ContextMenu/ContextMenuCheckboxItem.ts: clearpackages/core/src/ContextMenu/ContextMenuDivider.ts: clearpackages/core/src/ContextMenu/ContextMenuGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuItem.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioGroup.ts: clearpackages/core/src/ContextMenu/ContextMenuRadioItem.ts: clearpackages/core/src/ContextMenu/ContextMenuSubMenu.ts: clearpackages/core/src/ContextMenu/ContextMenuTrigger.tsx: clearpackages/core/src/ContextMenu/index.ts: clearpackages/core/src/DropdownMenu/DropdownMenuDivider.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuItem.tsx: clearpackages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx: clearpackages/core/src/DropdownMenu/renderDropdownItems.tsx: clearpackages/core/src/Table/TableCell.tsx: clearpackages/core/src/Table/TableCellContextMenu.loadFailure.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.modality.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.ssr.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.touch.test.tsx: clearpackages/core/src/Table/TableCellContextMenu.tsx: clearpackages/core/src/Table/TableHeaderCell.tsx: clearpackages/core/src/Table/TableHeaderCellContextMenu.test.tsx: clearpackages/core/src/Table/TableMenuWindowFocus.test.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.a11y.chromium.spec.ts: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.client.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.fixture.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.html: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.server.tsx: clearpackages/core/src/Table/__tests__/TableCellMenuLoad.vite.mjs: clearpackages/core/src/Table/__tests__/menuLoadScenario.tsx: clearpackages/core/src/Table/__tests__/warmTableContextMenu.tsx: clearpackages/core/src/Table/index.ts: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx: clearpackages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.test.tsx: clearpackages/core/src/Table/plugins/sortable/useTableSortable.tsx: clearpackages/core/src/Table/tableContextActions.ts: clearpackages/core/src/Table/tableContextMenu.test.tsx: clearpackages/core/src/Table/tableContextMenu.tsx: clearscripts/check-component-import-boundaries.mjs: clearscripts/check-component-import-boundaries.test.mjs: clearscripts/core-single-bundle.test.mjs: clearscripts/shared-identity.baseline.json: clear
…xt-menu ContextMenu keeps this branch's external-trigger surface and takes main's sheet choice (MenuBottomSheet only when the menu has items).
|
/approve-spec d5a198d |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, so the required checks still have to pass before it merges.
The lazy cell menu holds up after the merge of main: a table whose cells have no actions loads no menu code (the table reference page drops about 25 KB gzip), an early right-click, Shift+F10 or long press opens the menu once, a loaded menu looks and behaves as before, and the record edits for the load moment, the allowlist row and ContextMenuTrigger are approved for this head. One small note: the description's Testing tally (72 files, 1,388 tests) now reads 75 files and 1,407 tests after the merges of main.
Claims and files checked
Review mode: incremental; reason: none
- Release note, cells load their menu only when they have actions: verified (
TableCellContextMenu.tsx:214, no-load test inTableCellContextMenu.test.tsx). - Release note, a Table, Text and Button page loads about 23 to 25 KB less gzip: consistent (esbuild reference page −25,321 B gzip here; the Vite, Rolldown and webpack matrix was not rerun).
- Release note, content renders at once, the load starts on the first client render, and content keeps its node, focus and state: verified (
TableCellContextMenu.tsx:380-388, the body and header scenario tests, Chromium box test). - Release note, an early right-click, Shift+F10 or long press is held, opens once unless another press or key comes first, and the browser menu stays shut: verified (touch tests, Chromium early-invocation cases).
- Release note, a failed load keeps the table, returns the browser menu and asks the loader again later: verified (
TableCellContextMenu.loadFailure.test.tsx). - Release note, a test that expects the menu synchronously must wait, and
resolveContextActionskeeps its export without the menu: verified (warmTableContextMenu.tsx,Table/index.ts:63). - Description, no public API change and no new props, exports or data attributes: verified (API surface generator, zero rows; source diff).
- Description, action getters still resolve when the menu opens, and a loaded menu behaves as before: verified (
tableContextMenu.tsx:89, Table, ContextMenu and DropdownMenu suites, identical frames). - Description, the lazy graph imports modules directly and the alias modules keep an alias import from reaching the whole menu: verified (
core-single-bundle.test.mjs,ContextMenu/index.ts:18-28). - Description, the boundary check gains two base modules and loses the stale Table row: verified (
check-component-import-boundaries.mjs, the boundary check holds). - Description, static-graph table −25,449 B and menu +351 B gzip: consistent (−25,321 B and +359 B here).
- Description, the check prints Table eager at 50.5 KB: not reproduced locally (51.9 KB here; the record notes that local runs differ).
- Description, the vitest tally: stale (75 files and 1,407 tests pass now; non-blocking).
- Description, the Chromium box-and-axe and early-invocation cases pass: verified (4 of 4, Shift+F10 included).
- Description, typecheck, ESLint, Prettier, knowledge and changeset checks pass: verified.
- Description, the records changed and the authority list: verified against the four record diffs and the exact-head spec approval.
- Files,
ContextMenu.tsx,ContextMenuTrigger.tsx,ContextMenu/index.ts, the seven alias modules andContextMenu.test.tsx: clear (ContextMenuTriggeris named by the approvedcomponent:ContextMenuedit). - Files,
TableCellContextMenu.tsx,TableCell.tsx,TableHeaderCell.tsx,tableContextMenu.tsx,tableContextActions.ts,Table/index.tsand the sortable and row-expansion plugins: clear. - Files, the four DropdownMenu modules: clear (import paths only).
- Files, the five
TableCellContextMenutest files,TableHeaderCellContextMenu.test.tsx,TableMenuWindowFocus.test.tsx,tableContextMenu.test.tsx, the two plugin tests and the eight__tests__fixtures, helpers and Chromium spec: clear. - Files, the four records and the release note: clear (owner-approved at this head).
- Files, the boundary check, its test, the single-bundle test and the shared-identity baseline: clear.
Primary intent
A page that renders a Table whose cells have no context-menu actions no longer downloads the context menu. Today every Table, TableCell and TableHeaderCell import pulls in ContextMenu, DropdownMenu's menu code and the touch sheet, even when no column defines actions. This is a performance change with no product behavior change, which none of the narrower templates covers.
This PR supersedes #8403 by @rhagigi, ported onto current
main, and keeps @rhagigi as co-author. On top of that port it changes how a touch made before the menu code arrives is handled (see below), and it updates the import-boundary check and its record now that the Table crossing is gone.User or maintainer impact
data-*attributes. Action getters still resolve when the menu opens. A loaded menu behaves exactly as onmain.Problem and solution fit
resolveContextActionsand a newhasContextActionsmove to a dependency-freetableContextActions.ts, so cells and plugins read actions without importing the menu. The public export is unchanged.ContextMenuTrigger(the trigger wrapper and its 1px cursor anchor, no menu code) is shared by ContextMenu and the cell. The cell renders it around its content and lazy-loads only the menu beside it through the internalContextMenuForTriggermode and the sharedcreateModuleLoader. Neither module is exported publicly.ContextMenu/ContextMenuTriggerandLayer/gestureCounteras base code in surface folders, and the staleTable/tableContextMenu → ContextMenuallowlist row is removed.Authority
architecture:component-import-boundariesINV1–INV6: the menu is a surface revealed by interaction and loads through the shared module loader; the trigger contract is complete before load; an early intent is replayed once; the load moves no box; a failed load leaves the page working. INV2's "named moment after the first render" is named incomponent:TableCellPR1.component:TableCellPR1 ("a context menu loads only when actions are given"), FR4;component:TableHeaderCellFR3.component:ContextMenuFR1, FR10 (implementation gap note now names the cell's internal path).architecture:react-component-runtimeINV2/INV3 (interaction work in callbacks; the two Effects added name the system they sync: the shared hold's lifetime and a failed load).spec:AST-013FR9: the lazy menu is kept out of server markup and the hydrating render.Change and evidence
First-load bytes
Real bundlers, from the repository's first-load matrix (base
55674f90c2a, the merge base withmain→ headb1903553fb1; Core built asbuild:esm; React, React DOM and StyleX external; gzip in KB of 1,024 B; chunks are first-load requests):The menu page uses ContextMenu, so it pays for the trigger contract that now lives in its own module (
ContextMenuTrigger), about 0.35 KB. Under Rolldown, the table page's first load splits into 7 requests instead of 5.Static graph (
pnpm size:pageswith its module-count and depth report, esbuild; structural evidence, not the headline): table page −25,449 B gzip, static modules 635 → 616, module depth 12 → 12, chunks 13 → 13 (chunk depth 2); menu page +351 B gzip, static modules 266 → 272, module depth 8 → 8, chunks 11 → 11; docs and form +0. The import-boundary check passes, and its printout puts Table's eager gzip at 50.5 KB; the record carries that figure.Behavior checks
TableCellMenuLoad.a11y.chromium.spec.ts, a server-rendered, hydrated fixture whose server holds the menu chunk): a new case shows the cell's, trigger's and button's boxes are identical before and after the menu loads, axe reports no violation before or after, and the loaded menu opens on the first right-click. Existing cases cover a right-click, Shift+F10 and a long press made before the chunk arrives.Not covered: WebKit, recovery after a failed native chunk load in a real browser, and focus-ring pixels.
#8125 on top of this change (table page)
pnpm size:pages, this head (main 5b44d9a0 merged) against this head plus #8125's source (9cfc2fa), first-load gzip:So on top of this change, #8125 adds 57 B to the table page, under INV10's 307 B. Without this change, main's table page reached the whole ContextMenu. The measurement leaves out #8125's edits to
ContextMenu.tsxitself: those don't merge cleanly onto this head, and the table page reaches that module only on demand here, so they don't change its first load. #8125's shared gesture and Layer changes are included.Writing rubric results
Records changed:
architecture:component-import-boundaries(base-code list gainsContextMenu/ContextMenuTriggerandLayer/gestureCounter; the Table allowlist row and its current-state bullet are removed; one new allowlist row,Table/TableCellContextMenu→Layer/gestureCounter, at 0.0 KB; costs refreshed from the check's printout),component:TableCell(PR1 names when the load starts and how an early invocation is replayed;verified_byand the PR1 verification row list the tests),component:ContextMenu(Owns lines forContextMenuTriggerandContextMenuForTrigger; FR10's gap note names the cell's internal path),component:TableHeaderCell(PR1 "Resources": the cell's only state stays FR2's cut-heading tooltip, and a header cell with actions starts the menu load at the same moment ascomponent:TableCellPR1, with an early invocation held and replayed once; its verification row names the early Shift+F10 case and two gaps).Scope
Components: Table, TableCell, TableHeaderCell, ContextMenu, DropdownMenu (direct imports only)
Testing
vitest run packages/core/src/Table packages/core/src/ContextMenu packages/core/src/DropdownMenuafter mergingmain: 72 files, 1,388 tests pass.vitest run packages/core/src/Table/TableCellContextMenu*: touch tests (now 14: a press that strays past the move tolerance and comes back before the menu loads opens nothing, red on the previous head), load failure (now asserts one development warning, red on the previous head), modality, SSR and header-cell tests pass.vitest run --project node scripts/check-component-import-boundaries.test.mjs scripts/core-single-bundle.test.mjs: pass.pnpm check:component-import-boundaries: boundaries hold; Table eager 50.5 KB gzip. One new allowlist row,Table/TableCellContextMenu→Layer/gestureCounter(INV8, 0.0 KB: Text's own row already brings the module).playwright test TableCellMenuLoad.a11y.chromium.spec.ts(Chromium, run locally one case at a time with--single-process, which the local sandbox requires): the new box-and-axe case, the early right-click case and the early long-press case pass. The Shift+F10 case could not run locally: Chromium on macOS sends nocontextmenuevent for Shift+F10, so it needs the Linux CI run.pnpm -F @astryxdesign/core typecheck, ESLint and Prettier on changed files,pnpm check:knowledge,pnpm check:changesets: pass.Overlap checked: #11859 (menu press fix; shares DropdownMenuItem and DropdownMenuSubMenu, merges first), #8125 (iOS long-press ContextMenu, which this unblocks; merges first), #8080 (DropdownMenu device work; merges first)
Owner: @cixzhang; the Astryx fix loop shepherds it to merge. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue after #11859, #8080 and #8125.
Co-authored-by: Royi Hagigi (@rhagigi), from #8403.