diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-10-22 11:11:30 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-10-22 11:11:30 +0900 |
| commit | f0380f2d1c2afd9ce8d0be9479a23fca0b4ccdc6 (patch) | |
| tree | af8d118e671b81d671abd5171a3cb5ff29d4f4bc /packages/frontend | |
| parent | Bump version to 2025.10.1-beta.1 (diff) | |
| download | misskey-f0380f2d1c2afd9ce8d0be9479a23fca0b4ccdc6.tar.gz misskey-f0380f2d1c2afd9ce8d0be9479a23fca0b4ccdc6.tar.bz2 misskey-f0380f2d1c2afd9ce8d0be9479a23fca0b4ccdc6.zip | |
enhance(frontend): improve theme apply handling
Diffstat (limited to 'packages/frontend')
| -rw-r--r-- | packages/frontend/src/boot/common.ts | 3 | ||||
| -rw-r--r-- | packages/frontend/src/local-storage.ts | 1 | ||||
| -rw-r--r-- | packages/frontend/src/theme.ts | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 95ba278ff4..f9783cb65c 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -69,9 +69,6 @@ export async function common(createVue: () => Promise<App<Element>>) { if (lastVersion !== version) { miLocalStorage.setItem('lastVersion', version); - // テーマリビルドするため - miLocalStorage.removeItem('theme'); - try { // 変なバージョン文字列来るとcompareVersionsでエラーになるため if (lastVersion != null && compareVersions(version, lastVersion) === 1) { isClientUpdated = true; diff --git a/packages/frontend/src/local-storage.ts b/packages/frontend/src/local-storage.ts index 687983bcdb..f79f62f80e 100644 --- a/packages/frontend/src/local-storage.ts +++ b/packages/frontend/src/local-storage.ts @@ -25,6 +25,7 @@ export type Keys = ( 'bootloaderLocales' | 'theme' | 'themeId' | + 'themeCachedVersion' | 'customCss' | 'chatMessageDrafts' | 'scratchpad' | 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) { |