mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
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.values()].map((a, i) => {
|
||||
return <div className='attachment-item' key={`attachment-${i}`}>
|
||||
return <div className='attachment-item' key={attachmentKey(a, i)}>
|
||||
<ExpandableAttachment attachment={a} />
|
||||
</div>;
|
||||
})}
|
||||
@ -154,3 +154,7 @@ function downloadURL(attachment: Attachment) {
|
||||
params.dct = attachment.contentType;
|
||||
return attachmentURL(attachment, params);
|
||||
}
|
||||
|
||||
function attachmentKey(attachment: Attachment, index: number) {
|
||||
return index + '-' + (attachment.sha1 ? `sha1-` + attachment.sha1 : `path-` + attachment.path);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user