summaryrefslogtreecommitdiff
path: root/packages/frontend/src/theme.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-05-25 08:37:39 +0900
committerGitHub <noreply@github.com>2025-05-25 08:37:39 +0900
commitfab9db405c9de40549c08559a554b5690ae1f7f6 (patch)
tree98b9a2cabdc313999ea3729f6720d6af6dc84a86 /packages/frontend/src/theme.ts
parentBump version to 2025.5.1-beta.2 (diff)
downloadmisskey-fab9db405c9de40549c08559a554b5690ae1f7f6.tar.gz
misskey-fab9db405c9de40549c08559a554b5690ae1f7f6.tar.bz2
misskey-fab9db405c9de40549c08559a554b5690ae1f7f6.zip
fix(frontend): タブ間同期が行われるとテーマが切り替わり続ける問題を修正 (#16094)
Diffstat (limited to 'packages/frontend/src/theme.ts')
-rw-r--r--packages/frontend/src/theme.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts
index 9562f69cf3..e48eb04103 100644
--- a/packages/frontend/src/theme.ts
+++ b/packages/frontend/src/theme.ts
@@ -15,6 +15,7 @@ import { globalEvents } from '@/events.js';
import { miLocalStorage } from '@/local-storage.js';
import { $i } from '@/i.js';
import { prefer } from '@/preferences.js';
+import { deepEqual } from '@/utility/deep-equal.js';
export type Theme = {
id: string;
@@ -127,6 +128,7 @@ function applyThemeInternal(theme: Theme, persist: boolean) {
}
let timeout: number | null = null;
+let currentTheme: Theme | null = null;
export function applyTheme(theme: Theme, persist = true) {
if (timeout) {
@@ -134,6 +136,9 @@ export function applyTheme(theme: Theme, persist = true) {
timeout = null;
}
+ if (deepEqual(currentTheme, theme)) return;
+ currentTheme = theme;
+
if (window.document.startViewTransition != null && prefer.s.animation) {
window.document.documentElement.classList.add('_themeChanging_');
window.document.startViewTransition(async () => {