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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user