Skip to content

Commit

Permalink
refactor: correctly use itemKey in gallery
Browse files Browse the repository at this point in the history
This does not appear to have noticeable functional effect.
  • Loading branch information
WofWca committed Jan 12, 2025
1 parent 5c2cdbb commit c1d8d57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/frontend/src/components/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ export default class Gallery extends Component<
this.openFullscreenMedia.bind(this),
itemsPerRow,
}}
itemKey={({ rowIndex, columnIndex, data }) =>
data.mediaMessageIds[
rowIndex * itemsPerRow + columnIndex
]
}
>
{GalleryGridCell}
</FixedSizeGrid>
Expand Down Expand Up @@ -475,7 +480,7 @@ function GalleryGridCell({
return null
}
return (
<div style={{ ...style }} className='item' key={msgId}>
<div style={{ ...style }} className='item'>
<Component
messageId={msgId}
loadResult={message}
Expand Down Expand Up @@ -541,6 +546,7 @@ function FileTable({
mediaLoadResult,
queryText,
}}
itemKey={(index, data) => data.mediaMessageIds[index]}
>
{FileAttachmentRowWrapper}
</FixedSizeList>
Expand All @@ -567,7 +573,7 @@ function FileAttachmentRowWrapper({
return null
}
return (
<div style={style} className='item' key={msgId}>
<div style={style} className='item'>
<FileAttachmentRow
messageId={msgId}
loadResult={message}
Expand Down

0 comments on commit c1d8d57

Please sign in to comment.