From e57c853f20fa3e4b71d46349cca80b318534663c Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sun, 25 Oct 2026 20:15:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(theme):=20=E8=BD=AF=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=9B=9E=E9=80=80=E2=80=94=E2=80=94ThemeScri?= =?UTF-8?q?pt=20=E8=A1=A5=20data-astro-rerun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 病根:ClientRouter 软导航换 html 属性把 data-theme 抹回无主题态, 而内联脚本默认仅首次执行(Astro 规矩:重跑须显式 data-astro-rerun) ——切换明暗后一切栏目即回系统默认(用户实测报告) - 写入端审计:Header/Keyboard t/命令面板/终端四入口均写同一 localStorage key,无第二套实现,病灶唯一 - E2E 补软导航持久断言(原仅测 reload,漏了真实 bug 场景) 验证: node tests/e2e.mjs 31/31 PASS(软导航后=dark 断言新增) Spec: none (线上热修:单属性缺陷 + 回归断言) Co-authored-by: GLM-5.3 --- src/components/ThemeScript.astro | 5 ++++- tests/e2e.mjs | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/ThemeScript.astro b/src/components/ThemeScript.astro index e3ab50b..6d2d56f 100644 --- a/src/components/ThemeScript.astro +++ b/src/components/ThemeScript.astro @@ -3,7 +3,10 @@ // 优先级:用户手选(localStorage) > 系统偏好;切换按钮(T7 键盘/组件)写同一 key。 --- -