From b668063c521627eb1272438d143bdd573bb57a03 Mon Sep 17 00:00:00 2001 From: Bot Date: Thu, 16 Apr 2026 17:10:54 +0800 Subject: [PATCH] fix: resolve theme switching conflicts and layout shaking by refining Font CSS and ForceTheme logic --- src/App.tsx | 4 +++- src/index.css | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e6e46c4..e76091b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -47,7 +47,9 @@ const MainApp: React.FC = () => { window.ForceTheme as string !== "" ? window.ForceTheme : undefined; useEffect(() => { - if (forceTheme === "dark" || forceTheme === "light") { + const savedTheme = localStorage.getItem("vite-ui-theme"); + // Only auto-apply ForceTheme if the user hasn't manually picked one (or picked 'system') + if ((!savedTheme || savedTheme === "system") && (forceTheme === "dark" || forceTheme === "light")) { setTheme(forceTheme); } }, [forceTheme, setTheme]); diff --git a/src/index.css b/src/index.css index a7c066a..730c1e9 100644 --- a/src/index.css +++ b/src/index.css @@ -190,7 +190,6 @@ @layer base { * { @apply border-border; - font-family: 'LXGW WenKai Screen', sans-serif !important; } html { @apply scroll-smooth; @@ -200,9 +199,10 @@ /* font-feature-settings: "rlig" 1, "calt" 1; */ font-synthesis-weight: none; text-rendering: optimizeLegibility; + font-family: 'LXGW WenKai Screen', sans-serif; } h1, h2, h3, h4, h5, h6 { - font-family: 'LXGW WenKai Screen', sans-serif !important; + font-family: 'LXGW WenKai Screen', sans-serif; } }