mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(mod queue): conditionally virtualize table for large feeds
This commit is contained in:
@@ -522,14 +522,25 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
|
|||||||
<div className={styles.actionsHeader}>{t('actions')}</div>
|
<div className={styles.actionsHeader}>{t('actions')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Virtuoso
|
{/* Use Virtuoso for infinite scroll only when feed is large enough to warrant it */}
|
||||||
useWindowScroll
|
{feed.length > 25 ? (
|
||||||
data={feed}
|
<Virtuoso
|
||||||
totalCount={feed.length}
|
useWindowScroll
|
||||||
endReached={loadMore}
|
data={feed}
|
||||||
itemContent={(index, comment) => <ModQueueRow key={comment.cid} comment={comment} showBoardColumn={showBoardColumn} isOdd={index % 2 === 1} />}
|
totalCount={feed.length}
|
||||||
components={footerComponents}
|
endReached={loadMore}
|
||||||
/>
|
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
||||||
|
itemContent={(index, comment) => <ModQueueRow key={comment.cid} comment={comment} showBoardColumn={showBoardColumn} isOdd={index % 2 === 1} />}
|
||||||
|
components={footerComponents}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{feed.map((comment, index) => (
|
||||||
|
<ModQueueRow key={comment.cid} comment={comment} showBoardColumn={showBoardColumn} isOdd={index % 2 === 1} />
|
||||||
|
))}
|
||||||
|
<ModQueueFooter hasMore={hasMore} subplebbitAddresses={subplebbitAddresses} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user