Skip to content

test(DropdownMenu): the SSR test waits for the on-demand sheet before it ends - #8492

Merged
cixzhang merged 1 commit into
mainfrom
fix/dropdownmenu-ssr-teardown
Oct 26, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/dropdownmenu-ssr-teardown

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Maintainer impact

test-ui (2/4) fails intermittently on unrelated pull requests with EnvironmentTeardownError: Cannot load '…' after the environment was torn down, attributed to DropdownMenu.ssr.test.tsx. The missing module varies: CheckboxInput, or Tooltip via FieldLabel. Contributors rerun whole CI runs for a failure their change didn't cause.

Intended invariant

The DropdownMenu SSR test finishes every module load it starts before it ends.

Change

packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsx: after the hydration it checks, the test awaits ./MenuBottomSheet and ./MenuBottomSheetActionList, then unmounts.

Right after hydration, the bottom-sheet wrappers render, and each starts loading the touch sheet with React.lazy(import(…)). The test used to unmount at once and end while those loads were still pulling in BottomSheet's module graph. vi.resetModules() starts a fresh load in each of the three iterations. When a load finished after the file's environment was torn down, Vitest reported the error.

The assertion is unchanged: hydration still happens before the sheet loads, and no recoverable error may occur.

Evidence

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

  • pnpm vitest run --project ui packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsx.

@vercel

vercel Bot commented Oct 26, 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 26, 2026 4:49am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 26, 2026, 6:39 AM UTC

@github-actions

github-actions Bot commented Oct 26, 2026 •

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.1KB 72.1KB 0B 14.5KB 14.5KB 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 57.4KB 57.4KB 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.2KB 34.2KB 0B

Accessibility Audit

Status: No accessibility violations detected.


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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 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.

Recommended for approval: awaiting ./MenuBottomSheet and ./MenuBottomSheetActionList before unmounting removes the module loads that outlived the test and raised EnvironmentTeardownError, and the hydration assertion still catches an FR9 regression. No further changes are needed.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor Author

Posted by Cindy's agent on her behalf.

Decision (Cindy, 2026-10-25): approved under her standing rule to approve PRs CodeBunny recommends for approval. CodeBunny recommended approval at this exact head.

What this PR needs: green CI at this head, then it merges.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 720956d

@cixzhang
cixzhang merged commit d484045 into main Oct 26, 2026
69 checks passed
@github-actions
github-actions Bot deleted the fix/dropdownmenu-ssr-teardown branch October 27, 2026 06:22
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 — 720956d5 Deployed Oct 26, 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.

1 participant