feat: immediately insert user-created event into feed (#534)
This commit is contained in:
@@ -52,7 +52,7 @@ const NoteList = forwardRef(
|
|||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { startLogin } = useNostr()
|
const { startLogin, pubkey } = useNostr()
|
||||||
const { isUserTrusted } = useUserTrust()
|
const { isUserTrusted } = useUserTrust()
|
||||||
const { mutePubkeySet } = useMuteList()
|
const { mutePubkeySet } = useMuteList()
|
||||||
const { hideContentMentioningMutedUsers } = useContentPolicy()
|
const { hideContentMentioningMutedUsers } = useContentPolicy()
|
||||||
@@ -164,9 +164,15 @@ const NoteList = forwardRef(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNew: (event) => {
|
onNew: (event) => {
|
||||||
setNewEvents((oldEvents) =>
|
if (pubkey && event.pubkey === pubkey) {
|
||||||
[event, ...oldEvents].sort((a, b) => b.created_at - a.created_at)
|
// If the new event is from the current user, insert it directly into the feed
|
||||||
)
|
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)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user