From f00ed56a06095addba6a6f482b357646201ddf94 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 6 Jun 2023 19:31:33 +0700 Subject: [PATCH] fix build chat page --- src/app/chat/pages/index.page.tsx | 39 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/app/chat/pages/index.page.tsx b/src/app/chat/pages/index.page.tsx index 8fbeaf09..d9991918 100644 --- a/src/app/chat/pages/index.page.tsx +++ b/src/app/chat/pages/index.page.tsx @@ -24,29 +24,26 @@ export function Page() { ]); const add = useChatMessages((state: any) => state.add); - useSWRSubscription( - account.pubkey !== pubkey ? ["chat", pubkey] : null, - () => { - const unsubscribe = pool.subscribe( - [ - { - kinds: [4], - authors: [pubkey], - "#p": [account.pubkey], - since: dateToUnix(), - }, - ], - READONLY_RELAYS, - (event: any) => { - add(account.pubkey, event); + useSWRSubscription(account !== pubkey ? ["chat", pubkey] : null, () => { + const unsubscribe = pool.subscribe( + [ + { + kinds: [4], + authors: [pubkey], + "#p": [account.pubkey], + since: dateToUnix(), }, - ); + ], + READONLY_RELAYS, + (event: any) => { + add(account.pubkey, event); + }, + ); - return () => { - unsubscribe(); - }; - }, - ); + return () => { + unsubscribe(); + }; + }); useEffect(() => { fetchMessages(account.pubkey, pubkey);