1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-18 07:15:33 +02:00

enhance(frontend): improve theme apply handling

This commit is contained in:
syuilo
2025-10-22 11:11:30 +09:00
parent 130d065d0c
commit f0380f2d1c
3 changed files with 4 additions and 4 deletions

View File

@@ -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) {