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
+23 -14
View File
@@ -350,20 +350,29 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, i
<ErrorDisplay error={subplebbitError} /> <ErrorDisplay error={subplebbitError} />
</div> </div>
)} )}
<Virtuoso {effectiveInfiniteScroll ? (
defaultItemHeight={300} <Virtuoso
increaseViewportBy={{ bottom: 1200, top: 1200 }} defaultItemHeight={300}
totalCount={displayFeed.length} increaseViewportBy={{ bottom: 1200, top: 1200 }}
data={displayFeed} totalCount={displayFeed.length}
computeItemKey={(index, post) => post?.cid || `post-${index}`} data={displayFeed}
itemContent={(index, post) => <Post index={index} post={post} />} computeItemKey={(index, post) => post?.cid || `post-${index}`}
useWindowScroll={true} itemContent={(index, post) => <Post index={index} post={post} />}
components={footerComponents} useWindowScroll={true}
endReached={effectiveInfiniteScroll && hasMore ? loadMore : undefined} components={footerComponents}
ref={virtuosoRef} endReached={hasMore ? loadMore : undefined}
restoreStateFrom={lastVirtuosoState} ref={virtuosoRef}
initialScrollTop={lastVirtuosoState?.scrollTop} restoreStateFrom={lastVirtuosoState}
/> initialScrollTop={lastVirtuosoState?.scrollTop}
/>
) : (
<>
{displayFeed.map((post, index) => (
<Post key={post?.cid || `post-${index}`} index={index} post={post} />
))}
<footerComponents.Footer />
</>
)}
</div> </div>
</> </>
); );