feat: 💨

This commit is contained in:
codytseng
2025-12-24 23:31:03 +08:00
parent 1553227e13
commit 25b2831fcc
2 changed files with 7 additions and 5 deletions

View File

@@ -243,7 +243,12 @@ export default function ReplyNoteList({
setLoading(true)
const events = await client.loadMoreTimeline(timelineKey, until, LIMIT)
addReplies(events)
setUntil(events.length ? events[events.length - 1].created_at - 1 : undefined)
let newUntil = events.length ? events[events.length - 1].created_at - 1 : undefined
if (newUntil && event && newUntil < event.created_at) {
newUntil = undefined
}
setUntil(newUntil)
loadingRef.current = false
setLoading(false)
}
@@ -265,7 +270,7 @@ export default function ReplyNoteList({
observerInstance.unobserve(currentBottomRef)
}
}
}, [replies, showCount, until, timelineKey, loading])
}, [replies, showCount, until, timelineKey, loading, event])
return (
<div className="min-h-[80vh]">

View File

@@ -1,5 +1,4 @@
import { useDeletedEvent } from '@/providers/DeletedEventProvider'
import { useReply } from '@/providers/ReplyProvider'
import client from '@/services/client.service'
import { Event } from 'nostr-tools'
import { useEffect, useState } from 'react'
@@ -7,7 +6,6 @@ import { useEffect, useState } from 'react'
export function useFetchEvent(eventId?: string) {
const { isEventDeleted } = useDeletedEvent()
const [isFetching, setIsFetching] = useState(true)
const { addReplies } = useReply()
const [error, setError] = useState<Error | null>(null)
const [event, setEvent] = useState<Event | undefined>(undefined)
@@ -23,7 +21,6 @@ export function useFetchEvent(eventId?: string) {
const event = await client.fetchEvent(eventId)
if (event && !isEventDeleted(event)) {
setEvent(event)
addReplies([event])
}
}