Skip to content

test(DropdownMenu): the SSR test loads the menu and its sheet at collection - #8685

Merged
cixzhang merged 2 commits into
meta:mainfrom
vjeux:uikit/dropdown-ssr-collection-load
Oct 27, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
vjeux:uikit/dropdown-ssr-collection-load

Conversation

@vjeux

@vjeux vjeux commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review only this PR's change: vjeux/astryx@a4ca90c...d2430ba

Maintainer impact

DropdownMenu.ssr.test.tsx › "hydrates a bottom-sheet menu cleanly on the first renders of a server process" times out at 30 s under load (2 of 5 full runs on a loaded machine). It makes three fresh module graphs (vi.resetModules) and imports DropdownMenu and its two on-demand sheet modules in each, all inside its 30 s budget, so their first load (5.4 s alone, far more on a busy machine) is timed.

Intended invariant

A test's budget covers the behavior it checks, not a module's first load; collection, which is untimed, pays that (the pattern of #8471).

Change

A static import of DropdownMenu, MenuBottomSheet and MenuBottomSheetActionList at the top of the file loads them while it is collected. Each fresh graph then runs them again without that cost, and the sheet is still unloaded in each until the test imports it, so the test proves what it proved.

Evidence

  • Failure before the change: with a 31 s first load of the sheet injected (a one-time sleep in MenuBottomSheet.tsx, not committed), the test timed out at 30 s.
  • Success after the change: with the same injection it passes in 204 ms; without it, 150 ms instead of 5.4 s.
  • Product/runtime behavior verified unchanged: test-only.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

…ection

The test makes three fresh module graphs (vi.resetModules) and imports DropdownMenu and its two on-demand sheet modules in each, all inside its 30 s budget, so their first load (5.4 s alone, far more on a busy machine) timed out under load. A static import of the three modules at the top loads them while the file is collected, which is untimed; each fresh graph then runs them again without that cost, and the sheet is still unloaded in each until the test imports it. With a 31 s first load of the sheet injected, the test timed out at 30 s before and passes in 204 ms after.
@vercel

vercel Bot commented Oct 27, 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 Oct 27, 2026 9:10pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 27, 2026, 9:24 PM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This change looks good to merge. Loading DropdownMenu and its two sheet modules while the file is collected takes their first load out of the hydration test's 30 s budget, and the test still fails when the sheet wrapper renders during server render and hydration, so its spec:AST-013 FR9 coverage is unchanged. No further changes are needed.

[Automated review]

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/ContextMenuItem 16.6KB 16.6KB 0B 5.2KB 5.2KB 0B
core/DropdownMenu 72.7KB 72.7KB 0B 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 16.1KB 0B 5.6KB 5.6KB 0B
core/DropdownMenuDivider 6.6KB 6.6KB 0B 3.6KB 3.6KB 0B
core/DropdownMenuGroup 6.1KB 6.1KB 0B 3.3KB 3.3KB 0B
core/DropdownMenuItem 15.4KB 15.4KB 0B 5.2KB 5.2KB 0B
core/DropdownMenuRadioGroup 6.0KB 6.0KB 0B 3.2KB 3.2KB 0B
core/DropdownMenuRadioItem 16.2KB 16.2KB 0B 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 58.1KB 0B 9.5KB 9.5KB 0B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.6KB 34.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

…muting it

The hydration test silenced console.error and checked only React's recoverable errors, but React reports some mismatches only on the console: an attribute whose server value differs from the client's, for one. Nothing is logged today (all three hydrations log no console error), so the mute hid nothing yet; it would have hidden the next such mismatch. The test now watches console.error without muting it and asserts each hydration logs none.

Red first: with the server markup's aria-haspopup tampered so it differs at hydration, the muted test passed (no recoverable error) and this one fails, naming the console error.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incremental review of d2430ba..7a6e375; prior findings carried: none.

This change still looks good to merge. Watching console.error instead of muting it makes the hydration test fail when an attribute differs between the server render and the hydrating render, which React reports only on the console, and the test stays green when the sheet loads slowly. The title and description still describe only the collection-time load, so consider mentioning the console assertion there too.

[Automated review]

@cixzhang
cixzhang merged commit 1013274 into meta:main Oct 27, 2026
58 of 59 checks passed
@vjeux
vjeux deleted the uikit/dropdown-ssr-collection-load branch October 27, 2026 22:35
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
At the maintainer's request. DropdownMenu.ssr.test.tsx takes main's version: main's test (meta#8492, meta#8685) already waits for both on-demand sheet modules before the hydrated root unmounts, which covers the wait this pull request had added there. Nothing else conflicts.

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants