Skip to content

Commit

Permalink
fix: fix index message page loading
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Sep 15, 2024
1 parent 7b4b19d commit 1ae8470
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
async function initState() {
myState = await myMessageStateAsync()
myInfo = myState.info
myInfo_ = myInfo as Readable<UserInfo>
if ($myInfo) {
const iv = await myState.myIV()
const mk = await myState.masterKey(iv)
myInfo_ = myInfo as Readable<UserInfo>
if (!mk || !mk.isOpened() || myState.masterKeyKind() !== mk.kind) {
modalStore.trigger({
type: 'component',
Expand Down Expand Up @@ -58,7 +59,7 @@
}
</script>

{#if myInfo_}
{#if $myInfo}
<Chat {myState} myInfo={myInfo_} />
{:else}
<Home {myState} {myInfo} />
Expand Down
8 changes: 1 addition & 7 deletions src/ic_panda_frontend/src/lib/stores/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,7 @@ export class MyMessageState {
this.info = derived(api.myInfoStore, ($info, set) => {
if ($info) {
this.setCacheUserInfo(Date.now(), $info)
set($info)
} else {
KVS.get<[number, UserInfo]>('Users', this.id).then((rt) => {
if (rt) {
set(rt[1])
}
})
this.refreshAllState(false).then(() => set($info))
}
})
}
Expand Down

0 comments on commit 1ae8470

Please sign in to comment.