perf(build): split renderer routes and locale assets - #1283
Merged
Merged
Conversation
The renderer entry eagerly included chat, work panel, launcher, settings, and all changelog locales. Load these surfaces and catalogs on demand while preserving retained chat state and the existing changelog API. Remove the unused permission timestamp and silence an unused lock guard binding without changing permission expiry or request-budget behavior.
Keep the renderer source contract aligned with lazy loading and its error boundary, so the plugin launcher regression check continues to verify the current rendering path.
The extracted locale files contain declarative release notes and are loaded as independent chunks. Record that data boundary so the source-module budget only gates ordinary implementation modules.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Locale loading introduces an unhandled rejection path and lacks regression coverage for overlapping asynchronous language requests.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Splits renderer routes, locale catalogs, and release notes into lazy-loaded chunks to reduce startup payload while preserving existing APIs.
Changes:
- Adds lazy loading for renderer surfaces, work panel, release notes, and locale assets.
- Extracts changelog catalogs into locale-specific modules with caching.
- Removes unused Rust permission timing state and updates regression tests.
| File | Description |
|---|---|
packages/shared/src/changelog.test.ts |
Tests lazy catalog loading and caching. |
packages/shared/src/changelog.ts |
Preserves synchronous changelog APIs. |
packages/shared/src/changelog-runtime.ts |
Extracts locale/version normalization. |
packages/shared/src/changelog-loader.ts |
Dynamically loads locale catalogs. |
packages/shared/src/changelog-en.ts |
English changelog catalog. |
packages/shared/src/changelog-zh-CN.ts |
Simplified Chinese catalog. |
packages/shared/src/changelog-zh-TW.ts |
Traditional Chinese catalog. |
packages/shared/src/changelog-de.ts |
German changelog catalog. |
packages/shared/src/changelog-es.ts |
Spanish changelog catalog. |
packages/shared/src/changelog-fr.ts |
French changelog catalog. |
packages/shared/src/changelog-ko.ts |
Korean changelog catalog. |
packages/shared/src/changelog-pt-BR.ts |
Brazilian Portuguese catalog. |
packages/shared/src/changelog-tr.ts |
Turkish changelog catalog. |
packages/shared/package.json |
Exports the changelog loader. |
packages/i18n/src/locale-info.ts |
Extracts locale metadata and helpers. |
packages/i18n/src/index.ts |
Re-exports locale metadata. |
packages/i18n/package.json |
Exports locale-specific entry points. |
crates/host-core/src/rpc/mod.rs |
Retains lock lifetime without warning. |
crates/host-core/src/permissions.rs |
Removes unused monotonic timestamp state. |
apps/desktop/test/work-panel.test.mjs |
Updates work-panel lazy-loading contracts. |
apps/desktop/test/settings-general.test.mjs |
Tracks extracted language logic. |
apps/desktop/test/renderer-locale-loading.test.mjs |
Tests catalog loading and language switching. |
apps/desktop/test/plugin-launcher-window.test.mjs |
Updates launcher lazy-loading contract. |
apps/desktop/test/auto-update.test.mjs |
Verifies lazy release-note catalogs. |
apps/desktop/test/app-shell-settings-accessibility.test.mjs |
Verifies lazy chat mounting behavior. |
apps/desktop/src/styles/work-panel.css |
Styles the work-panel loading fallback. |
apps/desktop/src/main.tsx |
Lazily loads secondary renderer surfaces. |
apps/desktop/src/lib/renderer-language.ts |
Loads and applies locale catalogs asynchronously. |
apps/desktop/src/lib/renderer-catalogs.ts |
Implements cached renderer catalog imports. |
apps/desktop/src/lib/app-language.ts |
Connects asynchronous language loading to settings. |
apps/desktop/src/features/settings/agent-sections.tsx |
Lazily loads release notes. |
apps/desktop/src/features/app/AppShell.tsx |
Splits chat and work-panel code. |
apps/desktop/src/components/ReleaseNotesDialog.tsx |
Loads localized changelogs on demand. |
apps/desktop/electron.vite.config.ts |
Adds source aliases for locale chunks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+40
to
+42
| export async function applyAppLanguage( | ||
| language: AppSettings["language"], | ||
| ): Promise<void> { |
Comment on lines
+44
to
+48
| const request = ++languageRequest; | ||
| const apply = languageApplyQueue.then(async () => { | ||
| if (request !== languageRequest) return; | ||
| const catalog = await loadRendererCatalog(target); | ||
| if (request !== languageRequest) return; |
Keep source-contract checks aligned with the renderer startup refactor, where locale application and crash copy now flow through dedicated language and i18n helpers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Validation
pnpm build:jspnpm --filter @pi-desktop/desktop typecheckpnpm lintnode --testtargeted desktop regression files: 67/67 passedcargo fmt --checkcargo test -p host-core --locked: 711 passedcargo clippy -p host-core --all-targets --lockedpnpm test:e2e:layout: 192/192 passedVite still reports several individual chunks above 500 KB; this change splits the renderer entry and routes, while those remaining vendor/content chunks can be optimized separately.