Fix when there is no newer content

This commit is contained in:
xmflsct 2023-01-07 12:15:07 +01:00
parent 88528f5293
commit 23a8c03be2
1 changed files with 8 additions and 0 deletions

View File

@ -143,6 +143,8 @@ const TimelineRefresh: React.FC<Props> = ({
meta: {}
})
.then(res => {
if (!res.body.length) return
queryClient.setQueryData<
InfiniteData<
PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]>
@ -160,6 +162,11 @@ const TimelineRefresh: React.FC<Props> = ({
return res.body.length - PREV_PER_BATCH
})
.then(async nextLength => {
if (!nextLength) {
prevActive.current = false
return
}
for (let [index] of Array(Math.ceil(nextLength / PREV_PER_BATCH)).entries()) {
if (!fetchAndScrolled.value && index < 3 && scrollY.value > 15) {
fetchAndScrolled.value = true
@ -194,6 +201,7 @@ const TimelineRefresh: React.FC<Props> = ({
}
prevActive.current = false
})
.catch(err => console.warn(err))
}
const runFetchLatest = async () => {