feat: refresh profile page after posting
This commit is contained in:
@@ -136,6 +136,23 @@ export default function ProfileFeed({
|
|||||||
init()
|
init()
|
||||||
}, [pubkey, listMode, search])
|
}, [pubkey, listMode, search])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (pubkey !== myPubkey) return
|
||||||
|
|
||||||
|
const handleNewEvent = (data: Event) => {
|
||||||
|
const customEvent = data as CustomEvent<NostrEvent>
|
||||||
|
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) => {
|
const handleListModeChange = (mode: TNoteListMode) => {
|
||||||
setListMode(mode)
|
setListMode(mode)
|
||||||
noteListRef.current?.scrollToTop('smooth')
|
noteListRef.current?.scrollToTop('smooth')
|
||||||
|
|||||||
Reference in New Issue
Block a user