Conversation
6d9c6fa to
74ac8e7
Compare
perf(desktop): warm common route chunks while idle — idle-priority chunk preloading to remove first-click parse pause.
Approve. |
1 similar comment
perf(desktop): warm common route chunks while idle — idle-priority chunk preloading to remove first-click parse pause.
Approve. |
|
Closing because this was part of the older Desktop performance series and its route-wiring target has since been decomposed. The related series was measured and reduced to the portions with demonstrated gains, while this branch has no current-main product measurement that justifies rebuilding it. Any future route warming should start from current main with fresh timings. |

What does this PR do?
Warms the JavaScript chunks for five common Desktop routes after the gateway is open and the foreground has had time to settle. This removes the first-click chunk load/parse pause from Messaging, Artifacts, Cron, Settings, and Capabilities without moving those routes or their data fetches onto the startup critical path.
The warmup is deliberately bounded: it starts after a 1.5 second delay, uses
requestIdleCallbackwhen available, imports one chunk at a time with a 350 ms gap after completion, cancels if the gateway closes, and continues after an individual import failure. It runs only in the connected primary window; HUD, browser, and other auxiliary windows do not own normal navigation and do not pay this CPU or memory cost.It warms code only. Each route still performs its authoritative data load when opened. Agents, Command Center, Profiles, Webhooks, and Starmap remain cold so Desktop does not eagerly parse every optional surface.
Related Issue
N/A
Type of Change
Changes Made
How to Test
npm --workspace apps/desktop exec vitest run src/lib/idle-warmup.test.ts src/app/contrib/route-loaders.test.ts.npm --workspace apps/desktop run typecheck.Focused result: 4 Vitest tests passed. Desktop renderer, Electron, and E2E typechecks passed. Affected-file ESLint and
git diff --checkpassed.Desktop performance series
This change is one independently reviewable layer of the same Desktop startup and first-interaction performance pass.
hermes serveentry path.The three Python backend PRs share startup files but solve separate stages. Recommended landing order is #96749, then #96750, then #96751, rebasing the next PR only after the preceding one lands. #97032 is an independently reviewable Electron ordering change. The remaining renderer and Bot Mode PRs can also land independently; their effects compose without making cached state authoritative.
This PR owns idle code warmup: the connected primary window warms a small route set after the foreground settles, without prefetching route data.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Not applicable. The focused tests verify serialization, cancellation, and failure continuation.