Skip to content

Commit de7cbb3

Browse files
committed
fix(frontend): 初回読み込み時にエラーになることがある問題を修正
Fix #16562
1 parent 6cb6f79 commit de7cbb3

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Fix: PlayのAiScriptバージョン判定(v0.x系・v1.x系の判定)が正しく動作しない問題を修正
1717
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/1129)
1818
- Fix: フォロー申請をキャンセルする際の確認ダイアログの文言が不正確な問題を修正
19+
- Fix: 初回読み込み時にエラーになることがある問題を修正
1920

2021
### Server
2122
- Enhance: `clips/my-favorites` APIがページネーションに対応しました

packages/frontend/src/boot/common.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,15 @@ export async function common(createVue: () => Promise<App<Element>>) {
153153
});
154154
//#endregion
155155

156+
if (!isSafeMode) {
157+
// TODO: instance.defaultLightTheme/instance.defaultDarkThemeが不正な形式だった場合のケア
158+
if (prefer.s.lightTheme == null && instance.defaultLightTheme != null) prefer.commit('lightTheme', JSON.parse(instance.defaultLightTheme));
159+
if (prefer.s.darkTheme == null && instance.defaultDarkTheme != null) prefer.commit('darkTheme', JSON.parse(instance.defaultDarkTheme));
160+
}
161+
156162
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
157163
// NOTE: この処理は必ずダークモード判定処理より後に来ること(初回のテーマ適用のため)
164+
// NOTE: この処理は必ずサーバーテーマ適用処理より後に来ること(二重applyTheme発火を防ぐため)
158165
// see: https://github.com/misskey-dev/misskey/issues/16562
159166
watch(store.r.darkMode, (darkMode) => {
160167
const theme = (() => {
@@ -185,12 +192,6 @@ export async function common(createVue: () => Promise<App<Element>>) {
185192
applyTheme(theme ?? defaultLightTheme);
186193
}
187194
});
188-
189-
fetchInstanceMetaPromise.then(() => {
190-
// TODO: instance.defaultLightTheme/instance.defaultDarkThemeが不正な形式だった場合のケア
191-
if (prefer.s.lightTheme == null && instance.defaultLightTheme != null) prefer.commit('lightTheme', JSON.parse(instance.defaultLightTheme));
192-
if (prefer.s.darkTheme == null && instance.defaultDarkTheme != null) prefer.commit('darkTheme', JSON.parse(instance.defaultDarkTheme));
193-
});
194195
}
195196

196197
watch(prefer.r.overridedDeviceKind, (kind) => {

packages/frontend/src/theme.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ export function applyTheme(theme: Theme, persist = true) {
158158
// 様々な理由により startViewTransition は失敗することがある
159159
// ref. https://github.com/misskey-dev/misskey/issues/16562
160160

161+
// FIXME: viewTransitonエラーはtry~catch貫通してそうな気配がする
162+
161163
console.error(err);
162164

163165
window.document.documentElement.classList.remove('_themeChanging_');

0 commit comments

Comments
 (0)