From 477b2aed124158d5dca9704635b0156278c8a440 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 26 Sep 2026 23:05:04 +0200 Subject: [PATCH] perf: keep monaco and deferred shell chunks off every page's load Co-Authored-By: Claude Opus 5.5 (1M context) --- .../copilot/chat/AiChatLayout.svelte | 3 +- .../src/lib/components/home/ItemsList.svelte | 21 ++++++--- .../lib/components/search/RunsSearch.svelte | 12 +++-- frontend/src/lib/utils/paint.ts | 47 +++++++++++++++++++ .../src/routes/(root)/(logged)/+layout.svelte | 45 ++++++++++++++---- frontend/src/routes/(root)/+layout.svelte | 14 +++++- frontend/vite.config.js | 22 ++++++--- 7 files changed, 136 insertions(+), 28 deletions(-) diff --git a/frontend/src/lib/components/copilot/chat/AiChatLayout.svelte b/frontend/src/lib/components/copilot/chat/AiChatLayout.svelte index edcf9808cd..c85ef4189f 100644 --- a/frontend/src/lib/components/copilot/chat/AiChatLayout.svelte +++ b/frontend/src/lib/components/copilot/chat/AiChatLayout.svelte @@ -11,6 +11,7 @@ import { onDestroy } from 'svelte' import Button from '$lib/components/common/button/Button.svelte' import { Menu } from 'lucide-svelte' + import { whenPageIdle } from '$lib/utils/paint' interface Props { noPadding?: boolean @@ -102,7 +103,7 @@ {#if !disableAi} - {#await import('./CreatedResourceActionDrawers.svelte') then CreatedResourceActionDrawers} + {#await whenPageIdle().then(() => import('./CreatedResourceActionDrawers.svelte')) then CreatedResourceActionDrawers} {/await} diff --git a/frontend/src/lib/components/home/ItemsList.svelte b/frontend/src/lib/components/home/ItemsList.svelte index 45c30005a2..dc7d406349 100644 --- a/frontend/src/lib/components/home/ItemsList.svelte +++ b/frontend/src/lib/components/home/ItemsList.svelte @@ -1009,6 +1009,12 @@ // would put two of them on the page at once while the workspace is still empty. let hubPick = $state(undefined) let hubPickerOpen = $state(false) + // Mounted on the first pick and kept, so its dismissal and in-flight run outlive `hubPick`. + let importModalMounted = $state(false) + function pickHubProject(project: HubProjectPick) { + importModalMounted = true + hubPick = project + } /** * Whether a workspace the default listing found empty is empty at all, or just has nothing @@ -1941,7 +1947,7 @@ (hubPick = project)} + onPick={pickHubProject} onShowArchived={() => (filterValues.val = { ...filterValues.val, archived: true })} /> {:else} @@ -2073,13 +2079,16 @@ onClose={() => (hubPickerOpen = false)} onPick={(project) => { hubPickerOpen = false - hubPick = project + pickHubProject(project) }} /> - -{#await import('./ImportProjectModal.svelte') then ImportProjectModal} - (hubPick = undefined)} {onImported} /> -{/await} + +{#if importModalMounted} + {#await import('./ImportProjectModal.svelte') then ImportProjectModal} + (hubPick = undefined)} {onImported} /> + {/await} +{/if}