Skip to content

Commit

Permalink
fix: shouldLoadArchivedEntries condition
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Oct 28, 2024
1 parent 4ab132c commit 94b097f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions apps/renderer/src/modules/entry-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLDivElement>(null)
const virtuosoOptions = {
components: {
Expand Down Expand Up @@ -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 (
<div
className="relative flex h-full flex-1 flex-col @container"
Expand Down

0 comments on commit 94b097f

Please sign in to comment.