From f0380f2d1c2afd9ce8d0be9479a23fca0b4ccdc6 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:11:30 +0900 Subject: enhance(frontend): improve theme apply handling --- packages/frontend/src/theme.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages/frontend/src/theme.ts') diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts index 7cbaf87243..13f5dbf60e 100644 --- a/packages/frontend/src/theme.ts +++ b/packages/frontend/src/theme.ts @@ -10,6 +10,7 @@ import tinycolor from 'tinycolor2'; import lightTheme from '@@/themes/_light.json5'; import darkTheme from '@@/themes/_dark.json5'; import JSON5 from 'json5'; +import { version } from '@@/js/config.js'; import type { Ref } from 'vue'; import type { BundledTheme } from 'shiki/themes'; import { deepClone } from '@/utility/clone.js'; @@ -123,6 +124,7 @@ function applyThemeInternal(theme: Theme, persist: boolean) { if (persist) { miLocalStorage.setItem('theme', JSON.stringify(props)); miLocalStorage.setItem('themeId', theme.id); + miLocalStorage.setItem('themeCachedVersion', version); miLocalStorage.setItem('colorScheme', colorScheme); } @@ -139,7 +141,7 @@ export function applyTheme(theme: Theme, persist = true) { timeout = null; } - if (theme.id === currentThemeId) return; + if (theme.id === currentThemeId && miLocalStorage.getItem('themeCachedVersion') === version) return; currentThemeId = theme.id; if (window.document.startViewTransition != null) { -- cgit v1.2.3-freya