diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index 91935a0c..b41fdedc 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -498,8 +498,8 @@ const PostDesktop = ({ post, roles, showAllReplies, showReplies = true }: PostPr )} )} - {/* Virtuoso infinite scroll for post page view with more than 25 replies */} - {!isHidden && showAllReplies && !isInPendingPostView && showReplies && replyCount > 25 && ( + {/* Virtuoso infinite scroll for post page view when there's more content to paginate */} + {!isHidden && showAllReplies && !isInPendingPostView && showReplies && hasMore && ( )} - {/* Non-virtualized rendering for post page view with 25 or fewer replies */} + {/* Non-virtualized rendering for post page view when all replies fit on one page */} {!isHidden && showAllReplies && !isInPendingPostView && showReplies && - replyCount <= 25 && + !hasMore && filteredReplies.map((reply, index) => (
diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index def5d098..5e256d42 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -374,8 +374,8 @@ const PostMobile = ({ post, roles, showAllReplies, showReplies = true }: PostPro
)} - {/* Virtuoso infinite scroll for post page view with more than 25 replies */} - {!(pinned && !isInPostView) && showAllReplies && !isInPendingPostView && showReplies && replyCount > 25 && ( + {/* Virtuoso infinite scroll for post page view when there's more content to paginate */} + {!(pinned && !isInPostView) && showAllReplies && !isInPendingPostView && showReplies && hasMore && ( )} - {/* Non-virtualized rendering for post page view with 25 or fewer replies */} + {/* Non-virtualized rendering for post page view when all replies fit on one page */} {!(pinned && !isInPostView) && showAllReplies && !isInPendingPostView && showReplies && - replyCount <= 25 && + !hasMore && filteredReplies.map((reply, index) => (
diff --git a/src/views/board/board.tsx b/src/views/board/board.tsx index 81e30577..2f0b1047 100644 --- a/src/views/board/board.tsx +++ b/src/views/board/board.tsx @@ -381,18 +381,28 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, t
)} - } - useWindowScroll={true} - components={{ Footer }} - endReached={loadMore} - ref={virtuosoRef} - restoreStateFrom={lastVirtuosoState} - initialScrollTop={lastVirtuosoState?.scrollTop} - /> + {/* Use Virtuoso for infinite scroll only when there's more content to paginate */} + {hasMore ? ( + } + useWindowScroll={true} + components={{ Footer }} + endReached={loadMore} + ref={virtuosoRef} + restoreStateFrom={lastVirtuosoState} + initialScrollTop={lastVirtuosoState?.scrollTop} + /> + ) : ( + <> + {combinedFeed.map((post, index) => ( + + ))} +