summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-03-25 22:49:42 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-03-25 22:49:42 +0900
commit8e9bd0bbd53e707fe4c6679a359a2caeb914e3ad (patch)
tree3518568033558d18013d6c5eb8b9427cb2fa000a /src
parentNew Crowdin translations (#6181) (diff)
downloadsharkey-8e9bd0bbd53e707fe4c6679a359a2caeb914e3ad.tar.gz
sharkey-8e9bd0bbd53e707fe4c6679a359a2caeb914e3ad.tar.bz2
sharkey-8e9bd0bbd53e707fe4c6679a359a2caeb914e3ad.zip
Fix dark mode sync bug
Diffstat (limited to 'src')
-rw-r--r--src/client/init.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/init.ts b/src/client/init.ts
index b9c6aedae4..1fcd97190d 100644
--- a/src/client/init.ts
+++ b/src/client/init.ts
@@ -145,6 +145,12 @@ os.init(async () => {
}
}, false)
+ os.store.watch(state => state.device.darkMode, darkMode => {
+ // TODO: このファイルでbuiltinThemesを参照するとcode splittingが効かず、初回読み込み時に全てのテーマコードを読み込むことになってしまい無駄なので何とかする
+ const themes = builtinThemes.concat(os.store.state.device.themes);
+ applyTheme(themes.find(x => x.id === (darkMode ? os.store.state.device.darkTheme : os.store.state.device.lightTheme)));
+ });
+
//#region Sync dark mode
if (os.store.state.device.syncDeviceDarkMode) {
os.store.commit('device/set', { key: 'darkMode', value: isDeviceDarkmode() });
@@ -176,13 +182,6 @@ os.init(async () => {
isMobile: isMobile
};
},
- watch: {
- '$store.state.device.darkMode'() {
- // TODO: このファイルでbuiltinThemesを参照するとcode splittingが効かず、初回読み込み時に全てのテーマコードを読み込むことになってしまい無駄なので何とかする
- const themes = builtinThemes.concat(this.$store.state.device.themes);
- applyTheme(themes.find(x => x.id === (this.$store.state.device.darkMode ? this.$store.state.device.darkTheme : this.$store.state.device.lightTheme)));
- }
- },
methods: {
api: os.api,
signout: os.signout,