perf(board): disable Virtuoso when single-board pagination is on

This commit is contained in:
plebeius
2026-02-25 19:16:00 +08:00
parent b427810a69
commit 9b538f324d
+10 -1
View File
@@ -350,6 +350,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, i
<ErrorDisplay error={subplebbitError} /> <ErrorDisplay error={subplebbitError} />
</div> </div>
)} )}
{effectiveInfiniteScroll ? (
<Virtuoso <Virtuoso
defaultItemHeight={300} defaultItemHeight={300}
increaseViewportBy={{ bottom: 1200, top: 1200 }} increaseViewportBy={{ bottom: 1200, top: 1200 }}
@@ -359,11 +360,19 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, i
itemContent={(index, post) => <Post index={index} post={post} />} itemContent={(index, post) => <Post index={index} post={post} />}
useWindowScroll={true} useWindowScroll={true}
components={footerComponents} components={footerComponents}
endReached={effectiveInfiniteScroll && hasMore ? loadMore : undefined} endReached={hasMore ? loadMore : undefined}
ref={virtuosoRef} ref={virtuosoRef}
restoreStateFrom={lastVirtuosoState} restoreStateFrom={lastVirtuosoState}
initialScrollTop={lastVirtuosoState?.scrollTop} initialScrollTop={lastVirtuosoState?.scrollTop}
/> />
) : (
<>
{displayFeed.map((post, index) => (
<Post key={post?.cid || `post-${index}`} index={index} post={post} />
))}
<footerComponents.Footer />
</>
)}
</div> </div>
</> </>
); );