feat: 💨
This commit is contained in:
parent
1553227e13
commit
25b2831fcc
2 changed files with 7 additions and 5 deletions
|
|
@ -243,7 +243,12 @@ export default function ReplyNoteList({
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const events = await client.loadMoreTimeline(timelineKey, until, LIMIT)
|
const events = await client.loadMoreTimeline(timelineKey, until, LIMIT)
|
||||||
addReplies(events)
|
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
|
loadingRef.current = false
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +270,7 @@ export default function ReplyNoteList({
|
||||||
observerInstance.unobserve(currentBottomRef)
|
observerInstance.unobserve(currentBottomRef)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [replies, showCount, until, timelineKey, loading])
|
}, [replies, showCount, until, timelineKey, loading, event])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-[80vh]">
|
<div className="min-h-[80vh]">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { useDeletedEvent } from '@/providers/DeletedEventProvider'
|
import { useDeletedEvent } from '@/providers/DeletedEventProvider'
|
||||||
import { useReply } from '@/providers/ReplyProvider'
|
|
||||||
import client from '@/services/client.service'
|
import client from '@/services/client.service'
|
||||||
import { Event } from 'nostr-tools'
|
import { Event } from 'nostr-tools'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
@ -7,7 +6,6 @@ import { useEffect, useState } from 'react'
|
||||||
export function useFetchEvent(eventId?: string) {
|
export function useFetchEvent(eventId?: string) {
|
||||||
const { isEventDeleted } = useDeletedEvent()
|
const { isEventDeleted } = useDeletedEvent()
|
||||||
const [isFetching, setIsFetching] = useState(true)
|
const [isFetching, setIsFetching] = useState(true)
|
||||||
const { addReplies } = useReply()
|
|
||||||
const [error, setError] = useState<Error | null>(null)
|
const [error, setError] = useState<Error | null>(null)
|
||||||
const [event, setEvent] = useState<Event | undefined>(undefined)
|
const [event, setEvent] = useState<Event | undefined>(undefined)
|
||||||
|
|
||||||
|
|
@ -23,7 +21,6 @@ export function useFetchEvent(eventId?: string) {
|
||||||
const event = await client.fetchEvent(eventId)
|
const event = await client.fetchEvent(eventId)
|
||||||
if (event && !isEventDeleted(event)) {
|
if (event && !isEventDeleted(event)) {
|
||||||
setEvent(event)
|
setEvent(event)
|
||||||
addReplies([event])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue