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

+7 -11
View File
@@ -1,5 +1,8 @@
import ReactDOM from "react-dom/client";
import App from "./App";
import "./globals.css";
import { preloadInitialBootstrap } from "./lib/initial-bootstrap";
import { initializeI18n } from "./i18n";
import { initializePairReturn } from "./lib/remote-pair-return";
// `crypto.randomUUID` is only defined in secure contexts (HTTPS or localhost).
@@ -25,14 +28,6 @@ initializePairReturn();
window.addEventListener("hashchange", initializePairReturn);
async function renderWebui(container: HTMLElement) {
const takeInitialBootstrap = preloadInitialBootstrap();
const localeReady = import("./i18n").then(({ initializeI18n }) => initializeI18n());
const app = import("./mount");
// The HTML skeleton already resolved the initial route (including restart links).
// Warm only code: neither chat nor a socket mounts until App accepts the bootstrap.
if (container.querySelector('[data-startup-surface="chat"]')) {
void import("./components/thread/ThreadShell").catch(() => {});
}
// The critical skeleton paints immediately; React must wait for the full stylesheet.
const styles = [...document.querySelectorAll<HTMLLinkElement>("link[data-app-stylesheet]")]
.map((link) => new Promise<void>((resolve, reject) => {
@@ -43,8 +38,9 @@ async function renderWebui(container: HTMLElement) {
link.rel = "stylesheet";
if (link.sheet) ready();
}));
const [{ mountWebui }] = await Promise.all([app, localeReady, ...styles]);
mountWebui(container, takeInitialBootstrap);
await Promise.all([initializeI18n(), ...styles]);
/* StrictMode disabled: dev double-invokes state updaters; delta accumulation must stay pure — see useNanobotStream. */
ReactDOM.createRoot(container).render(<App />);
}
void renderWebui(root);