From dceebd1650b7fe54b80d120465272151fea03565 Mon Sep 17 00:00:00 2001 From: codytseng Date: Wed, 22 Oct 2025 22:56:13 +0800 Subject: [PATCH] feat: refresh profile page after posting --- src/components/Profile/ProfileFeed.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/Profile/ProfileFeed.tsx b/src/components/Profile/ProfileFeed.tsx index 74fbab3..d2a85a8 100644 --- a/src/components/Profile/ProfileFeed.tsx +++ b/src/components/Profile/ProfileFeed.tsx @@ -136,6 +136,23 @@ export default function ProfileFeed({ init() }, [pubkey, listMode, search]) + useEffect(() => { + if (pubkey !== myPubkey) return + + const handleNewEvent = (data: Event) => { + const customEvent = data as CustomEvent + const evt = customEvent.detail + if (evt.pubkey !== pubkey) return + + noteListRef.current?.refresh() + } + + client.addEventListener('newEvent', handleNewEvent) + return () => { + client.removeEventListener('newEvent', handleNewEvent) + } + }, [pubkey, myPubkey]) + const handleListModeChange = (mode: TNoteListMode) => { setListMode(mode) noteListRef.current?.scrollToTop('smooth')