修复详情预览切换卡旧图:改用缩略图并按 media.id 重建预览
This commit is contained in:
@@ -166,8 +166,10 @@ const SidebarContent = ({ media, hidePreview }: SidebarContentProps) => {
|
||||
const { updateSidebar } = useContext(SidebarContext)
|
||||
const { t } = useTranslation()
|
||||
let previewImage = null
|
||||
if (media.highRes) previewImage = media.highRes
|
||||
else if (media.thumbnail) previewImage = media.thumbnail
|
||||
// Use the (much smaller) thumbnail for the sidebar preview so switching
|
||||
// photos is instant instead of waiting for the huge high-res original.
|
||||
if (media.thumbnail) previewImage = media.thumbnail
|
||||
else if (media.highRes) previewImage = media.highRes
|
||||
|
||||
const imageAspect =
|
||||
previewImage?.width && previewImage?.height
|
||||
@@ -219,6 +221,7 @@ const SidebarContent = ({ media, hidePreview }: SidebarContentProps) => {
|
||||
style={{ paddingTop: `${Math.min(imageAspect, 0.75) * 100}%` }}
|
||||
>
|
||||
<PreviewMedia
|
||||
key={media.id}
|
||||
previewImage={previewImage || undefined}
|
||||
media={media}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user