mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(board): add computeItemKey to Virtuoso to prevent media flash on page change
Without `computeItemKey`, Virtuoso uses index-based keys so React reuses DOM nodes across pages, causing `<img>` elements to briefly flash old media before loading new sources.
This commit is contained in:
@@ -350,6 +350,7 @@ const Board = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp, i
|
|||||||
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
||||||
totalCount={displayFeed.length}
|
totalCount={displayFeed.length}
|
||||||
data={displayFeed}
|
data={displayFeed}
|
||||||
|
computeItemKey={(index, post) => post?.cid || `post-${index}`}
|
||||||
itemContent={(index, post) => <Post index={index} post={post} />}
|
itemContent={(index, post) => <Post index={index} post={post} />}
|
||||||
useWindowScroll={true}
|
useWindowScroll={true}
|
||||||
components={footerComponents}
|
components={footerComponents}
|
||||||
|
|||||||
Reference in New Issue
Block a user