Fix: dont incorrectly mark a feed empty based only on the first page (#2298)
This commit is contained in:
parent
2c37d47cf0
commit
28e0df595f
1 changed files with 4 additions and 1 deletions
|
|
@ -95,10 +95,13 @@ let Feed = ({
|
||||||
isFetchingNextPage,
|
isFetchingNextPage,
|
||||||
fetchNextPage,
|
fetchNextPage,
|
||||||
} = usePostFeedQuery(feed, feedParams, opts)
|
} = usePostFeedQuery(feed, feedParams, opts)
|
||||||
const isEmpty = !isFetching && !data?.pages[0]?.slices.length
|
|
||||||
if (data?.pages[0]) {
|
if (data?.pages[0]) {
|
||||||
lastFetchRef.current = data?.pages[0].fetchedAt
|
lastFetchRef.current = data?.pages[0].fetchedAt
|
||||||
}
|
}
|
||||||
|
const isEmpty = React.useMemo(
|
||||||
|
() => !isFetching && !data?.pages?.some(page => page.slices.length),
|
||||||
|
[isFetching, data],
|
||||||
|
)
|
||||||
|
|
||||||
const checkForNew = React.useCallback(async () => {
|
const checkForNew = React.useCallback(async () => {
|
||||||
if (!data?.pages[0] || isFetching || !onHasNew || !enabled) {
|
if (!data?.pages[0] || isFetching || !onHasNew || !enabled) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue