From 94b097fd25533b5d1437bf1054dbe44af7828099 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 28 Oct 2024 19:19:27 +0800 Subject: [PATCH] fix: shouldLoadArchivedEntries condition --- .../src/modules/entry-column/index.tsx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/renderer/src/modules/entry-column/index.tsx b/apps/renderer/src/modules/entry-column/index.tsx index c2eb153c05..c9cd9f4829 100644 --- a/apps/renderer/src/modules/entry-column/index.tsx +++ b/apps/renderer/src/modules/entry-column/index.tsx @@ -105,6 +105,22 @@ function EntryColumnImpl() { entries.totalCount < 40 && feed?.type === "feed" + const shouldLoadArchivedEntries = + !isArchived && + !unreadOnly && + !isCollection && + routeFeedId !== ROUTE_FEED_PENDING && + (feed?.type === "feed" || !feed) && + entries.totalCount === 0 && + !entries.isLoading + + // automatically fetch archived entries when there is no entries in timeline + useEffect(() => { + if (shouldLoadArchivedEntries) { + setIsArchived(true) + } + }, [shouldLoadArchivedEntries]) + const scrollRef = useRef(null) const virtuosoOptions = { components: { @@ -172,13 +188,6 @@ function EntryColumnImpl() { const navigate = useNavigateEntry() const isRefreshing = entries.isFetching && !entries.isFetchingNextPage - // automatically fetch archived entries when there is no entries in timeline - useEffect(() => { - if (showArchivedButton && virtuosoOptions.totalCount === 0 && !entries.isLoading) { - setIsArchived(true) - } - }, [entries.isLoading, showArchivedButton, virtuosoOptions.totalCount]) - return (