feat: lazy load things which are low-risk from main#2386
Conversation
Greptile SummaryThis PR reduces the initial bundle size by converting numerous eagerly-loaded modules (terminal, file browser, palettes, plugins, welcome page, prettier) into dynamic
Confidence Score: 5/5Safe to merge; changes are well-scoped lazy-loading refactors and a cleaner LSP logging architecture with no impact on core editor behaviour. All lazy-load conversions are straightforward dynamic imports with existing fallback patterns. The LSP logging refactor replaces fragile console monkey-patching with explicit call-sites and is fully backward-compatible. The openFolder ordering fix is strictly better. The only concrete issue found is a CSS @supports scope leak in welcome.scss that only materialises on browsers lacking gap support — not a concern for Acode's Android WebView target. src/pages/welcome/welcome.scss — @supports not (gap: 1px) block now at top level instead of inside #welcome-tab. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[App Boot / main.js] --> B[Eager: core editor, settings, sidebar]
A --> C{files restored?}
C -->|no files| D["lazy: pages/welcome ⟶ openWelcomeTab()"]
C -->|has files| E[restoreFiles]
E --> F[sessionStorage: isfilesRestored=true]
F --> G[acode.exec save-state]
G --> H[initFileList]
H --> I["lazy: components/terminal ⟶ restorePersistedSessions()"]
A --> J[User action]
J --> K{command?}
K -->|files / open-file / open-folder| L["lazy: pages/fileBrowser (shared chunk)"]
K -->|command-palette / find-file| M["lazy: palettes/*"]
K -->|syntax / change-theme| N["lazy: palettes/changeMode / changeTheme"]
K -->|new-terminal| O["lazy: components/terminal"]
K -->|open settings/help/plugins/about| P["lazy: settings/* / pages/*"]
K -->|open-inapp-browser| Q["lazy: plugins/browser"]
K -->|format| R["lazy: lib/prettierFormatter via registerPrettierFormatter"]
style D fill:#e8f5e9
style L fill:#e8f5e9
style M fill:#e8f5e9
style N fill:#e8f5e9
style O fill:#e8f5e9
style P fill:#e8f5e9
style Q fill:#e8f5e9
style R fill:#e8f5e9
style I fill:#e8f5e9
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[App Boot / main.js] --> B[Eager: core editor, settings, sidebar]
A --> C{files restored?}
C -->|no files| D["lazy: pages/welcome ⟶ openWelcomeTab()"]
C -->|has files| E[restoreFiles]
E --> F[sessionStorage: isfilesRestored=true]
F --> G[acode.exec save-state]
G --> H[initFileList]
H --> I["lazy: components/terminal ⟶ restorePersistedSessions()"]
A --> J[User action]
J --> K{command?}
K -->|files / open-file / open-folder| L["lazy: pages/fileBrowser (shared chunk)"]
K -->|command-palette / find-file| M["lazy: palettes/*"]
K -->|syntax / change-theme| N["lazy: palettes/changeMode / changeTheme"]
K -->|new-terminal| O["lazy: components/terminal"]
K -->|open settings/help/plugins/about| P["lazy: settings/* / pages/*"]
K -->|open-inapp-browser| Q["lazy: plugins/browser"]
K -->|format| R["lazy: lib/prettierFormatter via registerPrettierFormatter"]
style D fill:#e8f5e9
style L fill:#e8f5e9
style M fill:#e8f5e9
style N fill:#e8f5e9
style O fill:#e8f5e9
style P fill:#e8f5e9
style Q fill:#e8f5e9
style R fill:#e8f5e9
style I fill:#e8f5e9
Reviews (4): Last reviewed commit: "improved lsp logs and fix lsp settings" | Re-trigger Greptile |
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Ajit Kumar <dellevenjack@gmail> Co-authored-by: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com>
…n/Acode into lazy-load-things
No description provided.