From 9e6d13ce46f4605bf35679f571a9f2760d55eada Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 30 Dec 2021 01:37:16 +0900 Subject: [PATCH] :v: --- packages/client/src/pizzax.ts | 2 +- packages/client/src/ui/chat/index.vue | 4 +++- packages/client/src/ui/deck.vue | 4 +++- packages/client/src/ui/deck/deck-store.ts | 2 -- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index bbd68e762f..479799d1f9 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -55,7 +55,7 @@ export class Storage { return new Promise(async (resolve, reject) => { await this.migrate(); - const deviceState: State = await get(this.deviceStateKeyName); + const deviceState: State = await get(this.deviceStateKeyName) || {}; const deviceAccountState = $i ? await get(this.deviceAccountStateKeyName) || {} : {}; const registryCache = $i ? await get(this.registryCacheKeyName) || {} : {}; diff --git a/packages/client/src/ui/chat/index.vue b/packages/client/src/ui/chat/index.vue index f66ab4dcee..10cad6b98e 100644 --- a/packages/client/src/ui/chat/index.vue +++ b/packages/client/src/ui/chat/index.vue @@ -160,12 +160,14 @@ export default defineComponent({ } }, - created() { + async created() { if (window.innerWidth < 1024) { localStorage.setItem('ui', 'default'); location.reload(); } + await store.ready; + os.api('users/lists/list').then(lists => { this.lists = lists; }); diff --git a/packages/client/src/ui/deck.vue b/packages/client/src/ui/deck.vue index 73dc83180f..e1718d3df9 100644 --- a/packages/client/src/ui/deck.vue +++ b/packages/client/src/ui/deck.vue @@ -68,7 +68,7 @@ export default defineComponent({ DeckColumnCore, }, - setup() { + async setup() { const isMobile = ref(window.innerWidth <= 500); window.addEventListener('resize', () => { isMobile.value = window.innerWidth <= 500; @@ -81,6 +81,8 @@ export default defineComponent({ drawerMenuShowing.value = false; }); + await deckStore.ready; + const columns = deckStore.reactiveState.columns; const layout = deckStore.reactiveState.layout; const menuIndicated = computed(() => { diff --git a/packages/client/src/ui/deck/deck-store.ts b/packages/client/src/ui/deck/deck-store.ts index c9200ad981..6b6b02f3f9 100644 --- a/packages/client/src/ui/deck/deck-store.ts +++ b/packages/client/src/ui/deck/deck-store.ts @@ -61,8 +61,6 @@ export const deckStore = markRaw(new Storage('deck', { export const loadDeck = async () => { let deck; - await deckStore.ready; - try { deck = await api('i/registry/get', { scope: ['client', 'deck', 'profiles'],