mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(board): disable Virtuoso when single-board pagination is on
This commit is contained in:
+23
-14
@@ -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>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user