diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-11-06 18:07:03 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-11-06 18:07:03 +0900 |
| commit | 26c8914a26d08aa33bc75177f8db36594defb921 (patch) | |
| tree | a226f3d8ba2f286bcf5296a54c49bba92e7710e2 | |
| parent | enhance(frontend): Extend links to profile pages (#16417) (diff) | |
| download | misskey-26c8914a26d08aa33bc75177f8db36594defb921.tar.gz misskey-26c8914a26d08aa33bc75177f8db36594defb921.tar.bz2 misskey-26c8914a26d08aa33bc75177f8db36594defb921.zip | |
fix(frontend): improve startViewTransition handling
| -rw-r--r-- | packages/frontend/src/theme.ts | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts index 4da8c02d33..2fca4e79ae 100644 --- a/packages/frontend/src/theme.ts +++ b/packages/frontend/src/theme.ts @@ -146,17 +146,26 @@ export function applyTheme(theme: Theme, persist = true) { if (window.document.startViewTransition != null) { window.document.documentElement.classList.add('_themeChanging_'); - window.document.startViewTransition(async () => { - applyThemeInternal(theme, persist); - await nextTick(); - }).finished.then(() => { + try { + window.document.startViewTransition(async () => { + applyThemeInternal(theme, persist); + await nextTick(); + }).finished.then(() => { + window.document.documentElement.classList.remove('_themeChanging_'); + globalEvents.emit('themeChanged'); + }); + } catch (err) { + // 様々な理由により startViewTransition は失敗することがある + // ref. https://github.com/misskey-dev/misskey/issues/16562 + + console.error(err); + window.document.documentElement.classList.remove('_themeChanging_'); - // 色計算など再度行えるようにクライアント全体に通知 + applyThemeInternal(theme, persist); globalEvents.emit('themeChanged'); - }); + } } else { applyThemeInternal(theme, persist); - // 色計算など再度行えるようにクライアント全体に通知 globalEvents.emit('themeChanged'); } } |