fix: devモードの特定条件下でページが表示されなくなる問題を修正 (#12653)
* fix: devモードでキャッシュクリアするとページが表示されなくなる問題を修正 * fix: localeがnullの場合も最新のlocaleを取得するように
This commit is contained in:
parent
386fcedf35
commit
239507d7d6
2 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,7 @@ import { compareVersions } from 'compare-versions';
|
||||||
import widgets from '@/widgets/index.js';
|
import widgets from '@/widgets/index.js';
|
||||||
import directives from '@/directives/index.js';
|
import directives from '@/directives/index.js';
|
||||||
import components from '@/components/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 { applyTheme } from '@/scripts/theme.js';
|
||||||
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
||||||
import { i18n, updateI18n } from '@/i18n.js';
|
import { i18n, updateI18n } from '@/i18n.js';
|
||||||
|
@ -88,7 +88,7 @@ export async function common(createVue: () => App<Element>) {
|
||||||
|
|
||||||
//#region Detect language & fetch translations
|
//#region Detect language & fetch translations
|
||||||
const localeVersion = miLocalStorage.getItem('localeVersion');
|
const localeVersion = miLocalStorage.getItem('localeVersion');
|
||||||
const localeOutdated = (localeVersion == null || localeVersion !== version);
|
const localeOutdated = (localeVersion == null || localeVersion !== version || locale == null);
|
||||||
if (localeOutdated) {
|
if (localeOutdated) {
|
||||||
const res = await window.fetch(`/assets/locales/${lang}.${version}.json`);
|
const res = await window.fetch(`/assets/locales/${lang}.${version}.json`);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { fetchCustomEmojis } from '@/custom-emojis.js';
|
||||||
export async function clearCache() {
|
export async function clearCache() {
|
||||||
os.waiting();
|
os.waiting();
|
||||||
miLocalStorage.removeItem('locale');
|
miLocalStorage.removeItem('locale');
|
||||||
|
miLocalStorage.removeItem('localeVersion');
|
||||||
miLocalStorage.removeItem('theme');
|
miLocalStorage.removeItem('theme');
|
||||||
miLocalStorage.removeItem('emojis');
|
miLocalStorage.removeItem('emojis');
|
||||||
miLocalStorage.removeItem('lastEmojisFetchedAt');
|
miLocalStorage.removeItem('lastEmojisFetchedAt');
|
||||||
|
|
Loading…
Reference in a new issue