From f075cd92a3a08f1b9f27d47c694ee2b609601d2b Mon Sep 17 00:00:00 2001 From: Sawyer Date: Tue, 29 Sep 2026 22:15:03 -0700 Subject: [PATCH] feat(web): boot in the saved theme with no flash (CL-8479) --- apps/web/index.html | 10 ++++++++++ apps/web/src/theme-store.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/apps/web/index.html b/apps/web/index.html index 3b0727772..67efc12ae 100644 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -7,6 +7,16 @@ name="description" content="Corbits Workbench: deploy, run, and supervise agents from one interface." /> + Corbits Workbench diff --git a/apps/web/src/theme-store.ts b/apps/web/src/theme-store.ts index 63663f84b..0bf67a111 100644 --- a/apps/web/src/theme-store.ts +++ b/apps/web/src/theme-store.ts @@ -12,6 +12,8 @@ export function isTheme(value: unknown): value is Theme { } const DEFAULT_KEY = "corbits-theme"; +// Unscoped copy of the last-set theme; the boot script in index.html reads it. +const LAST_KEY = "corbits-theme:last"; let storageKey = DEFAULT_KEY; let current: Theme = "light"; @@ -33,6 +35,7 @@ function apply(theme: Theme) { else root.setAttribute("data-theme", theme); // react-ui's `dark:` variant keys off the class. root.classList.toggle("dark", theme === "dark"); + root.style.colorScheme = theme === "dark" ? "dark" : "light"; } function commit(theme: Theme) { @@ -53,6 +56,7 @@ export function setTheme(theme: Theme) { commit(theme); try { window.localStorage.setItem(storageKey, theme); + window.localStorage.setItem(LAST_KEY, theme); } catch (error) { reportError(error, { operation: "theme_persist" }); }