fix(ui mode): make sure key for attachment view is unique (#32084)
Fixes #32052.
This commit is contained in:
parent
80e014f4b6
commit
44445e30e5
|
|
@ -131,7 +131,7 @@ export const AttachmentsTab: React.FunctionComponent<{
|
||||||
})}
|
})}
|
||||||
{attachments.size ? <div className='attachments-section'>Attachments</div> : undefined}
|
{attachments.size ? <div className='attachments-section'>Attachments</div> : undefined}
|
||||||
{[...attachments.values()].map((a, i) => {
|
{[...attachments.values()].map((a, i) => {
|
||||||
return <div className='attachment-item' key={`attachment-${i}`}>
|
return <div className='attachment-item' key={attachmentKey(a, i)}>
|
||||||
<ExpandableAttachment attachment={a} />
|
<ExpandableAttachment attachment={a} />
|
||||||
</div>;
|
</div>;
|
||||||
})}
|
})}
|
||||||
|
|
@ -154,3 +154,7 @@ function downloadURL(attachment: Attachment) {
|
||||||
params.dct = attachment.contentType;
|
params.dct = attachment.contentType;
|
||||||
return attachmentURL(attachment, params);
|
return attachmentURL(attachment, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function attachmentKey(attachment: Attachment, index: number) {
|
||||||
|
return index + '-' + (attachment.sha1 ? `sha1-` + attachment.sha1 : `path-` + attachment.path);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue