From d3f0704eaed2edd72c54aa8de0799c5ac8e0dba1 Mon Sep 17 00:00:00 2001 From: codytseng Date: Mon, 17 Nov 2025 21:35:47 +0800 Subject: [PATCH] feat: disable automatic insertion of new notes in NoteList by default --- src/components/NoteList/index.tsx | 10 +++++----- src/components/Profile/ProfileFeed.tsx | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index 1d006367..d4a9bbc9 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -43,7 +43,8 @@ const NoteList = forwardRef( areAlgoRelays = false, showRelayCloseReason = false, pinnedEventIds, - filterFn + filterFn, + showNewNotesDirectly = false }: { subRequests: TFeedSubRequest[] showKinds: number[] @@ -54,11 +55,12 @@ const NoteList = forwardRef( showRelayCloseReason?: boolean pinnedEventIds?: string[] filterFn?: (event: Event) => boolean + showNewNotesDirectly?: boolean }, ref ) => { const { t } = useTranslation() - const { startLogin, pubkey } = useNostr() + const { startLogin } = useNostr() const { isUserTrusted } = useUserTrust() const { mutePubkeySet } = useMuteList() const { hideContentMentioningMutedUsers } = useContentPolicy() @@ -263,13 +265,11 @@ const NoteList = forwardRef( } }, onNew: (event) => { - if (pubkey && event.pubkey === pubkey) { - // If the new event is from the current user, insert it directly into the feed + if (showNewNotesDirectly) { setEvents((oldEvents) => oldEvents.some((e) => e.id === event.id) ? oldEvents : [event, ...oldEvents] ) } else { - // Otherwise, buffer it and show the New Notes button setNewEvents((oldEvents) => [event, ...oldEvents].sort((a, b) => b.created_at - a.created_at) ) diff --git a/src/components/Profile/ProfileFeed.tsx b/src/components/Profile/ProfileFeed.tsx index 74fbab3f..8bc589ad 100644 --- a/src/components/Profile/ProfileFeed.tsx +++ b/src/components/Profile/ProfileFeed.tsx @@ -169,6 +169,7 @@ export default function ProfileFeed({ hideReplies={listMode === 'posts'} filterMutedNotes={false} pinnedEventIds={listMode === 'you' || !!search ? [] : pinnedEventIds} + showNewNotesDirectly={myPubkey === pubkey} /> )