Skip to content

fix(core): lazy-load usePopover in SideNavHeading (#264)#4310

Open
jibin7jose wants to merge 1 commit into
facebook:mainfrom
jibin7jose:fix-sidenav-heading-264
Open

fix(core): lazy-load usePopover in SideNavHeading (#264)#4310
jibin7jose wants to merge 1 commit into
facebook:mainfrom
jibin7jose:fix-sidenav-heading-264

Conversation

@jibin7jose

Copy link
Copy Markdown

Summary

This PR resolves issue #264 by lazy-loading the heavy usePopover and Layer engine resources inside the SideNavHeading component.

Changes Made

  • Extracted shared CSS into SideNavHeading.stylex.ts to prevent circular dependencies.
  • Extracted static, non-interactive heading UI into SideNavHeadingStatic.tsx.
  • Extracted the heavy, popover-dependent menu interactions into SideNavHeadingWithMenu.tsx.
  • Updated SideNavHeading.tsx to conditionally load SideNavHeadingWithMenu using React lazy() and <Suspense>, falling back to the static rendering logic if no menu prop is provided.

Impact

Previously, SideNavHeading eagerly imported the Popover engine, bloating the initial bundle size for all users—even when no menu was provided. With this change, applications that use a simple, static SideNav without menus will completely skip downloading the popover logic, resulting in a much smaller bundle size and faster load times.

Fixes #264

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 25, 2026 4:56am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 25, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Jul 25, 2026
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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PageNavHeader: lazy-load popover/layer resources when menu is not provided

1 participant