From 239507d7d6d0a8574bb641adee66d9da96537bb9 Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:21:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20dev=E3=83=A2=E3=83=BC=E3=83=89=E3=81=AE?= =?UTF-8?q?=E7=89=B9=E5=AE=9A=E6=9D=A1=E4=BB=B6=E4=B8=8B=E3=81=A7=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(#12653)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: devモードでキャッシュクリアするとページが表示されなくなる問題を修正 * fix: localeがnullの場合も最新のlocaleを取得するように --- packages/frontend/src/boot/common.ts | 4 ++-- packages/frontend/src/scripts/clear-cache.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 60f2781fd..728f39962 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -8,7 +8,7 @@ import { compareVersions } from 'compare-versions'; import widgets from '@/widgets/index.js'; import directives from '@/directives/index.js'; import components from '@/components/index.js'; -import { version, ui, lang, updateLocale } from '@/config.js'; +import { version, ui, lang, updateLocale, locale } from '@/config.js'; import { applyTheme } from '@/scripts/theme.js'; import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js'; import { i18n, updateI18n } from '@/i18n.js'; @@ -88,7 +88,7 @@ export async function common(createVue: () => App) { //#region Detect language & fetch translations const localeVersion = miLocalStorage.getItem('localeVersion'); - const localeOutdated = (localeVersion == null || localeVersion !== version); + const localeOutdated = (localeVersion == null || localeVersion !== version || locale == null); if (localeOutdated) { const res = await window.fetch(`/assets/locales/${lang}.${version}.json`); if (res.status === 200) { diff --git a/packages/frontend/src/scripts/clear-cache.ts b/packages/frontend/src/scripts/clear-cache.ts index 5f27254b8..f2db87c4f 100644 --- a/packages/frontend/src/scripts/clear-cache.ts +++ b/packages/frontend/src/scripts/clear-cache.ts @@ -6,6 +6,7 @@ import { fetchCustomEmojis } from '@/custom-emojis.js'; export async function clearCache() { os.waiting(); miLocalStorage.removeItem('locale'); + miLocalStorage.removeItem('localeVersion'); miLocalStorage.removeItem('theme'); miLocalStorage.removeItem('emojis'); miLocalStorage.removeItem('lastEmojisFetchedAt');