fix(client): 更新時にテーマキャッシュをクリアするように

This commit is contained in:
syuilo 2021-08-12 12:02:41 +09:00
parent 555954c71e
commit c88ea7150c
2 changed files with 17 additions and 1 deletions

View File

@ -14,6 +14,9 @@
- Docker: Node.jsを16.6.2に - Docker: Node.jsを16.6.2に
- 依存関係の更新 - 依存関係の更新
### Bugfixes
- Misskey更新時、テーマキャッシュの影響でスタイルがおかしくなる問題を修正
## 12.86.0 (2021/08/11) ## 12.86.0 (2021/08/11)
### Improvements ### Improvements

View File

@ -16,7 +16,7 @@ import { router } from '@client/router';
import { applyTheme } from '@client/scripts/theme'; import { applyTheme } from '@client/scripts/theme';
import { isDeviceDarkmode } from '@client/scripts/is-device-darkmode'; import { isDeviceDarkmode } from '@client/scripts/is-device-darkmode';
import { i18n } from '@client/i18n'; import { i18n } from '@client/i18n';
import { stream, dialog, post } from '@client/os'; import { stream, dialog, post, popup } from '@client/os';
import * as sound from '@client/scripts/sound'; import * as sound from '@client/scripts/sound';
import { $i, refreshAccount, login, updateAccount, signout } from '@client/account'; import { $i, refreshAccount, login, updateAccount, signout } from '@client/account';
import { defaultStore, ColdDeviceStorage } from '@client/store'; import { defaultStore, ColdDeviceStorage } from '@client/store';
@ -198,6 +198,19 @@ if (splash) {
splash.style.pointerEvents = 'none'; splash.style.pointerEvents = 'none';
} }
// クライアントが更新されたか?
const lastVersion = localStorage.getItem('lastVersion');
if (lastVersion !== version) {
localStorage.setItem('lastVersion', version);
// テーマリビルドするため
localStorage.removeItem('theme');
// TODO: バージョンが新しくなった時だけダイアログ出す
//popup();
}
// NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため)
watch(defaultStore.reactiveState.darkMode, (darkMode) => { watch(defaultStore.reactiveState.darkMode, (darkMode) => {
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme')); applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
}, { immediate: localStorage.theme == null }); }, { immediate: localStorage.theme == null });