perf: improve admin page cold starts

This commit is contained in:
2026-06-22 12:05:17 +08:00
parent c5d9bac0ed
commit c8756be02e
8 changed files with 284 additions and 34 deletions
+6 -6
View File
@@ -68,11 +68,11 @@ function scheduleIdle(callback: () => void) {
const browserWindow = window as WindowWithIdleCallback;
if (browserWindow.requestIdleCallback) {
browserWindow.requestIdleCallback(callback, { timeout: 3000 });
browserWindow.requestIdleCallback(callback, { timeout: 8000 });
return;
}
window.setTimeout(callback, 1200);
window.setTimeout(callback, 8000);
}
function canPrefetch() {
@@ -160,7 +160,7 @@ function prefetchAiPlatformPages(currentPath = '') {
}
if (isSystemRoute(currentPath)) {
delayedPrefetch(`core:${currentPath}`, corePrefetchTasks, 8000);
delayedPrefetch(`core:${currentPath}`, corePrefetchTasks, 18_000);
return;
}
@@ -168,7 +168,7 @@ function prefetchAiPlatformPages(currentPath = '') {
delayedPrefetch(
`agent-chat:${currentPath}`,
[aiPrefetchTasks.agentChat, aiPrefetchTasks.aiChatPanel],
6000,
14_000,
);
return;
}
@@ -177,12 +177,12 @@ function prefetchAiPlatformPages(currentPath = '') {
delayedPrefetch(
`ai:${currentPath}`,
getAiRoutePrefetchTasks(currentPath),
6000,
14_000,
);
return;
}
delayedPrefetch('core:home', corePrefetchTasks, 10_000);
delayedPrefetch('core:home', corePrefetchTasks, 22_000);
}
export { prefetchAiPlatformPages };