Skip to content

Stabilize root app shell renders#2776

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/react-component-health-c155
Draft

Stabilize root app shell renders#2776
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/react-component-health-c155

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 21, 2026

What Changed

  • Hoisted the static root app shell JSX out of RootRouteView so route-level re-renders do not recreate the CommandPalette / AppSidebarLayout element tree.
  • Moved the browser chrome theme synchronization effect into a named hook, useBrowserChromeThemeSync.
  • Added React Scan before/after recordings:

Why

react-doctor flagged static JSX in src/routes/__root.tsx as a performance warning because the root shell was recreated on every root route render. Hoisting the shell makes the shared shell element stable while the nested Outlet continues to update from router context.

Scan results:

  • Before: react-doctor score 73, 253 warnings.
  • After: react-doctor score 74, 252 warnings.
  • The rendering-hoist-jsx warning for src/routes/__root.tsx is removed.

UI Changes

No intended visual changes. React Scan recordings above capture the same route-navigation flow with React Scan enabled before and after the fix.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Validation:

  • bun fmt
  • bun lint
  • bun typecheck
Open in Web View Automation 

Note

Stabilize root app shell renders by hoisting JSX to a module-level constant

  • Extracts the CommandPalette -> AppSidebarLayout -> Outlet JSX tree into a module-level APP_SHELL constant in __root.tsx, replacing a per-render local variable to prevent unnecessary re-renders.
  • Extracts the browser chrome theme sync logic into a new useBrowserChromeThemeSync(pathname) hook, replacing an inline useEffect in RootRouteView.

Macroscope summarized 993571a.

cursoragent and others added 2 commits May 21, 2026 16:23
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant