diff --git a/CHANGELOG.md b/CHANGELOG.md index 3672772665..da2116bf54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Enhance: 絵文字ピッカーのサイズをより大きくできるように - Enhance: 時刻計算のための基準値を一か所で管理するようにし、パフォーマンスを向上 - Fix: iOSで、デバイスがダークモードだと初回読み込み時にエラーになる問題を修正 +- Fix: 設定データの移行が完了しているクライアントでは、設定データ移行用のプログラムの読み込みをスキップするように ### Server - Enhance: ユーザーIPを確実に取得できるために設定ファイルにFastifyOptions.trustProxyを追加しました diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts index 18817d3f79..6fea9122ad 100644 --- a/packages/frontend/src/boot/main-boot.ts +++ b/packages/frontend/src/boot/main-boot.ts @@ -27,7 +27,6 @@ import { makeHotkey } from '@/utility/hotkey.js'; import { addCustomEmoji, removeCustomEmojis, updateCustomEmojis } from '@/custom-emojis.js'; import { prefer } from '@/preferences.js'; import { updateCurrentAccountPartial } from '@/accounts.js'; -import { migrateOldSettings } from '@/pref-migrate.js'; import { unisonReload } from '@/utility/unison-reload.js'; export async function mainBoot() { @@ -74,6 +73,8 @@ export async function mainBoot() { if (lastVersion && (compareVersions('2025.3.2-alpha.0', lastVersion) === 1)) { console.log('Preferences migration'); + const { migrateOldSettings } = await import('@/pref-migrate.js'); + migrateOldSettings(); } } diff --git a/packages/frontend/src/pref-migrate.ts b/packages/frontend/src/pref-migrate.ts index 8258bbb846..d3cc0961b1 100644 --- a/packages/frontend/src/pref-migrate.ts +++ b/packages/frontend/src/pref-migrate.ts @@ -14,15 +14,23 @@ import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; // TODO: そのうち消す -export function migrateOldSettings() { +export async function migrateOldSettings() { os.waiting({ text: i18n.ts.settingsMigrating }); - store.loaded.then(async () => { - misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: any) => { + const minWait = new Promise(resolve => { + window.setTimeout(() => { + resolve(); + }, 5000); + }); + + const migratePromise = store.loaded.then(async () => { + const migrationPromises: Promise[] = []; + + migrationPromises.push(misskeyApi('i/registry/get', { scope: ['client'], key: 'themes' }).catch(() => []).then((themes: any) => { if (themes.length > 0) { prefer.commit('themes', themes); } - }); + })); const plugins = ColdDeviceStorage.get('plugins'); prefer.commit('plugins', plugins.map(p => { @@ -35,7 +43,7 @@ export function migrateOldSettings() { })); prefer.commit('deck.profile', deckStore.s.profile); - misskeyApi('i/registry/keys', { + migrationPromises.push(misskeyApi('i/registry/keys', { scope: ['client', 'deck', 'profiles'], }).then(async keys => { const profiles: DeckProfile[] = []; @@ -52,7 +60,7 @@ export function migrateOldSettings() { }); } prefer.commit('deck.profiles', profiles); - }); + })); prefer.commit('lightTheme', ColdDeviceStorage.get('lightTheme')); prefer.commit('darkTheme', ColdDeviceStorage.get('darkTheme')); @@ -146,8 +154,11 @@ export function migrateOldSettings() { prefer.commit('defaultNoteVisibility', store.s.defaultNoteVisibility); prefer.commit('defaultNoteLocalOnly', store.s.defaultNoteLocalOnly); - window.setTimeout(() => { - unisonReload(); - }, 10000); + await Promise.all(migrationPromises); }); + + // 最低5秒 or 設定移行が完了するまで待つ + await Promise.all([migratePromise, minWait]); + + unisonReload(); }