From cc39ac6eb0e9705a9884b7fd94cbdc10c7edcc51 Mon Sep 17 00:00:00 2001 From: 0xZensh Date: Sun, 15 Sep 2024 21:05:53 +0800 Subject: [PATCH] fix: fix 'myInfo' state --- .../components/messages/ChannelDetail.svelte | 4 +- .../src/lib/components/messages/Chat.svelte | 4 +- .../src/lib/components/messages/Home.svelte | 21 ++++--- .../src/lib/components/messages/Index.svelte | 45 ++++++++------ .../components/messages/MyChannelList.svelte | 5 +- .../components/messages/ProfileDetail.svelte | 60 ++++++++----------- .../messages/UserRegisterModel.svelte | 49 +++------------ .../src/lib/stores/message.ts | 5 ++ 8 files changed, 83 insertions(+), 110 deletions(-) diff --git a/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte b/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte index 8beb9cb..2de461a 100644 --- a/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte +++ b/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte @@ -8,7 +8,6 @@ import IconPanda from '$lib/components/icons/IconPanda.svelte' import { toastRun } from '$lib/stores/toast' import { - myMessageStateAsync, type ChannelInfoEx, type MyMessageState } from '$src/lib/stores/message' @@ -20,12 +19,12 @@ import ChannelSetting from './ChannelSetting.svelte' export let channelId: string + export let myState: MyMessageState const toastStore = getToastStore() const { canister, id } = ChannelAPI.parseChannelParam(channelId) const onChatBack = getContext('onChatBack') as () => void - let myState: MyMessageState let myInfo: Readable let channelInfo: Readable @@ -49,7 +48,6 @@ const { abort, finally: onfinally } = toastRun( async (signal: AbortSignal) => { if (canister) { - myState = await myMessageStateAsync() myInfo = myState.info as Readable channelInfo = await myState.loadChannelInfo(canister, id) openSettings = !$channelInfo._kek diff --git a/src/ic_panda_frontend/src/lib/components/messages/Chat.svelte b/src/ic_panda_frontend/src/lib/components/messages/Chat.svelte index f105380..d6eb22f 100644 --- a/src/ic_panda_frontend/src/lib/components/messages/Chat.svelte +++ b/src/ic_panda_frontend/src/lib/components/messages/Chat.svelte @@ -44,7 +44,7 @@ ? '' : 'max-sm:-translate-x-full'} grid grid-rows-[1fr_auto] border-r border-surface-500/30 bg-white max-sm:shadow-sm sm:rounded-tl-2xl" > - +