From 28e0df595fef024526da4a0ba22cba9fdc07808f Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sun, 24 Dec 2023 11:48:50 -0800 Subject: [PATCH] Fix: dont incorrectly mark a feed empty based only on the first page (#2298) --- src/view/com/posts/Feed.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 3d38fbbc..02a3537e 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -95,10 +95,13 @@ let Feed = ({ isFetchingNextPage, fetchNextPage, } = usePostFeedQuery(feed, feedParams, opts) - const isEmpty = !isFetching && !data?.pages[0]?.slices.length if (data?.pages[0]) { 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 () => { if (!data?.pages[0] || isFetching || !onHasNew || !enabled) {