Skip to content

perf(components): lazy-load settings tab bodies off the shell - #495

Closed
slashdevcorpse wants to merge 2 commits into
LodyAI:mainfrom
slashdevcorpse:perf/settings-tab-code-split
Closed

slashdevcorpse wants to merge 2 commits into
LodyAI:mainfrom
slashdevcorpse:perf/settings-tab-code-split

Conversation

@slashdevcorpse

Copy link
Copy Markdown
Contributor

Related issue

Closes #493

Problem / pressure

Electron does not enable TanStack auto code-splitting. routeTree.gen.ts statically imports every settings route, and those files plus DesktopSettingsModal statically import tab bodies (MCP, billing, stats, agent config). Authenticated-shell cold start parses that graph before Settings opens.

Summary

Settings tab bodies load through lazy() from each route file, matching archive.tsx, and from SettingsTabContent in the desktop modal. Navigate-only legacy routes (general, stats, devices, my-machines, agent-config) are unchanged. Whole-app autoCodeSplitting is not enabled.

Before / after

Before After
MCP/billing/stats/agent-config modules parse with the shell. Those modules load when the tab or modal tab mounts.
Closed desktop settings dialog still imported every tab. Dialog chrome stays; tab bodies lazy() behind Suspense.

Test plan

  • pnpm exec prettier --write on the changed settings routes and desktop-settings-modal.tsx.
  • No Electron bundle comparison in this PR. No live first-open timing.

Context handoff

Instructions for reviewing agents

  • Review focus: lazy() wrappers in settings/*.tsx (except Navigate-only legacy routes) and desktop-settings-modal.tsx SettingsTabContent.
  • Decisions to challenge: Per-tab lazy() instead of enabling autoCodeSplitting in electron.vite.config.ts. Suspense fallback={null} while a tab chunk loads.
  • Plausible failures / evidence gaps: First Settings open still pays for the default account tab. No before/after chunk list from an Electron renderer build.

Authoring context

  • User goal / directives: Code-split settings tab modules off the authenticated desktop shell without duplicating perf(components): stage mobile background sync so the app stays usable #317.
  • Constraints / non-goals: Do not enable whole-app router auto-splitting. Do not change settings behavior or MCP catalog reads on chat landing.
  • Risk-bearing decisions: A brief empty panel while a tab chunk loads (fallback={null}).
  • Destructive or irreversible behavior: None.
  • Deliberately not done or tested: Electron production bundle sizes. Mobile settings layout chrome. Command palette split.
  • Unknowns / confidence: High that static imports of tab bodies are gone from these files. Medium on measured cold-start delta without a bundle dump.

Route files and the desktop modal load each tab through lazy(), matching archive.tsx. Navigate-only legacy settings routes stay eager.

Model: grok-4.6
@slashdevcorpse
slashdevcorpse marked this pull request as ready for review September 8, 2026 03:21
Copilot AI lite review requested due to automatic review settings September 8, 2026 03:21

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

BillingSettingsRoute suspends behind RouteSuspense, so the first mobile render was empty until the mocked chunk resolved.

Model: grok-4.6
@github-actions github-actions Bot added the status:needs-pr-attention External PR needs contributor attention before review label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@slashdevcorpse, this pull request was closed because it did not meet Lody's contribution requirements for 7 days.

Open a new pull request using the current template to continue contributing this change. This pull request will not be reopened.

@github-actions github-actions Bot added the status:pr-policy-expired PR closed after contribution requirements remained unmet for seven days label Sep 16, 2026
@github-actions github-actions Bot closed this Sep 16, 2026
@github-actions github-actions Bot removed the status:needs-pr-attention External PR needs contributor attention before review label Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: components status:pr-policy-expired PR closed after contribution requirements remained unmet for seven days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Desktop settings tab modules parse on authenticated-shell cold start

2 participants