Skip to content

refactor(DropdownMenu): a failed sheet preload is the preload's result, not an empty catch - #9069

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:fix/menu-sheet-preload-result
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:fix/menu-sheet-preload-result

Conversation

@vjeux

@vjeux vjeux commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Follows #8478.

Maintainer impact

#8478 stopped a failed preload of a bottom-sheet DropdownMenu's action list from raising an unhandled rejection, using loadActionList().catch(() => {}). An empty handler hides every error in that chain, not only the expected failed load, so a real defect there would go unnoticed.

What led to it: a sweep of recent changes for error handlers that catch and default.

Intended invariant

A sheet preload's failure is its result, never a rejection and never swallowed: preloadMenuBottomSheetActionList resolves {isLoaded: true}, or {isLoaded: false, error} with the loader's error. As before, a failed load is not kept, so the next open loads the list.

Change

  • lazyMenuBottomSheet.ts: the preload returns that result (an ActionListPreload type, internal to DropdownMenu).
  • DropdownMenu.tsx: its effect starts the preload with void; after a failure, the first open loads the list.
  • lazyMenuBottomSheet.test.ts: checks the result, no unhandled rejection, and a retry on the next call.
  • A [chore] changeset: callers see no change.

Options considered:

  • Keep the empty handler: it hides errors other than the expected one.
  • Log the failure: a console line is no contract, and the first open already surfaces a real failure through lazy().
  • Return the failure as the result (chosen): the expected failure becomes part of the contract, and nothing is dropped.

Prior art: no open pull request touches preloadMenuBottomSheetActionList, lazyMenuBottomSheet.ts or an ActionListPreload type (searched by those names and "sheet preload").

Evidence

  • On main fd0aba8, the updated lazyMenuBottomSheet.test.ts fails; it passes here.
  • The rest of DropdownMenu's tests pass unchanged, within pnpm test:ui (16,454 passed).

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 exec vitest run packages/core/src/DropdownMenu/lazyMenuBottomSheet.test.ts: fails on main, passes here.

Local gates at 45046fe: build, typecheck, lint, pnpm test:ui (16,454), pnpm test:node (all but #8520's two known cache.test.mjs failures, and two of main's load-sensitive cases, ci-scope-pr-diff.test.mjs and component-size.test.mjs: 30 s timeouts at box load 70–85; they pass alone on main fd0aba8 and this head), CLI (47), Storybook, the DropdownMenu and Menu accessibility specs in Chromium (228), Prettier, changeset coverage, and the knowledge, changeset and repo checks.

…t, not an empty catch

meta#8478 stopped a failed preload of the bottom sheet's action list from
raising an unhandled rejection with `loadActionList().catch(() => {})`. An
empty handler also hides any other error in that chain.
preloadMenuBottomSheetActionList now resolves to whether the list loaded:
{isLoaded: true}, or {isLoaded: false, error} with the loader's error. It
never rejects, and nothing swallows an error. DropdownMenu's effect starts
it with `void`; after a failure the first open loads the list, as before.

lazyMenuBottomSheet.test.ts checks that result, along with no unhandled
rejection and a retry on the next call. A [chore] changeset: callers see no
change.
@vercel

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

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 30, 2026
@astracat-bot

astracat-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 11:31 PM UTC

@github-actions

github-actions Bot commented Oct 30, 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 54.5KB 54.5KB 0B 9.8KB 9.8KB 0B
core/DropdownMenu 74.1KB 74.2KB +24B 15.2KB 15.2KB 0B
core/DropdownMenuCheckboxItem 17.3KB 17.3KB 0B 5.8KB 5.8KB 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 16.6KB 16.6KB 0B 5.4KB 5.4KB 0B
core/DropdownMenuRadioGroup 6.0KB 6.0KB 0B 3.2KB 3.2KB 0B
core/DropdownMenuRadioItem 17.4KB 17.4KB 0B 5.8KB 5.8KB 0B
core/DropdownMenuSubMenu 59.8KB 59.8KB 0B 9.8KB 9.8KB 0B
core/MoreMenu 74.4KB 74.5KB +25B 15.2KB 15.2KB 0B
lab/CommentThread N/A 218.4KB N/A N/A 2.4KB N/A
lab/Comments N/A 222.9KB N/A N/A 2.5KB N/A

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 35.6KB 35.6KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


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

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

No changes needed: the sheet preload's failure now comes back as a typed result instead of an empty .catch, and nothing changes for people using a sheet menu. The updated test covers the failure result and the retry on the next call, and the DropdownMenu tests, typecheck and lint pass.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 02:35
@cixzhang
cixzhang merged commit 3a25c59 into meta:main Oct 31, 2026
138 of 142 checks passed
@vjeux
vjeux deleted the fix/menu-sheet-preload-result branch October 31, 2026 04:35

This branch was successfully deployed

1 active deployment
Preview — 45046fe7 Deployed Oct 30, 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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