fix(webui): restore startup flow while keeping recovery batching (#6712)

* fix(webui): restore startup flow while keeping recovery batching

Keep the two restart recovery scans from #6708. Withdraw the browser preload and launcher changes until they can be measured independently against the Windows first-send regression.

* fix(webui): skip graph layout measurement in reduced motion

A zero-duration shared layout still measured the panel while the 500-node graph was mounting. Disable the shared-layout link in reduced motion and start the browser budget after the initial graph paints. Keep the existing 150ms limit and all 500 node checks.
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-18 23:40:49 +08:00
1 parent cab49a1c66
commit 995f9e36c1
21 files changed
+260 -400

No files matched your search

+4 -22
View File
@@ -47,27 +47,11 @@ function guardWebuiEntryChunk(): Plugin {
apply: "build",
generateBundle(_options, bundle) {
for (const output of Object.values(bundle)) {
if (output.type !== "chunk") continue;
// The external document entry starts the app and chat imports concurrently.
// Protect their real static closures too, not just the tiny dispatcher.
const isApp = output.facadeModuleId?.endsWith("/src/mount.tsx");
const isChat = output.facadeModuleId?.endsWith("/components/thread/ThreadShell.tsx");
if (!output.isEntry && !isApp && !isChat) continue;
const imports = new Set<string>();
const visit = (name: string) => {
if (imports.has(name)) return;
imports.add(name);
const dependency = bundle[name];
if (dependency?.type === "chunk") dependency.imports.forEach(visit);
};
output.imports.forEach(visit);
const unexpected = entryLazyFeatureImports([...imports]);
if (output.isEntry && output.facadeModuleId?.endsWith("/index.html")) {
unexpected.push(...[...imports].filter((name) => path.basename(name).startsWith("react-vendor-")));
}
if (output.type !== "chunk" || !output.isEntry) continue;
const unexpected = entryLazyFeatureImports(output.imports);
if (unexpected.length > 0) {
throw new Error(
`${output.fileName} statically imports deferred WebUI features: ${unexpected.join(", ")}`,
`WebUI entry chunk statically imports lazy features: ${unexpected.join(", ")}`,
);
}
}
@@ -113,14 +97,12 @@ export function webuiManualChunk(id: string): string | undefined {
|| (id.includes("node_modules/micromark-extension-math/") && id.endsWith("/html.js"))) {
return "markdown-math";
}
// The document entry uses dynamic imports before mounting. Keep their tiny helper
// independent: putting it in react-vendor makes the bootstrap wait for React DOM.
if (id.includes("vite/preload-helper")) return "preload-helper";
if (
id.includes("node_modules/react/")
|| id.includes("node_modules/react-dom/")
|| id.includes("node_modules/scheduler/")
|| id.includes("node_modules/clsx/")
|| id.includes("vite/preload-helper")
) {
return "react-vendor";
}