result.attachments always exists

This commit is contained in:
Simon Knott 2024-10-10 11:12:57 +02:00
parent 468c1215cd
commit 15c32f0679
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -80,7 +80,7 @@ export const TestResultView: React.FC<{
}> = ({ result, anchor }) => { }> = ({ result, anchor }) => {
const { screenshots, videos, traces, otherAttachments, diffs, htmls } = React.useMemo(() => { const { screenshots, videos, traces, otherAttachments, diffs, htmls } = React.useMemo(() => {
const attachments = result?.attachments || []; const attachments = result.attachments;
const screenshots = new Set(attachments.filter(a => getAttachmentCategory(a) === 'screenshot')); const screenshots = new Set(attachments.filter(a => getAttachmentCategory(a) === 'screenshot'));
const videos = attachments.filter(a => getAttachmentCategory(a) === 'video'); const videos = attachments.filter(a => getAttachmentCategory(a) === 'video');
const traces = attachments.filter(a => getAttachmentCategory(a) === 'trace'); const traces = attachments.filter(a => getAttachmentCategory(a) === 'trace');
@ -88,7 +88,7 @@ export const TestResultView: React.FC<{
const otherAttachments = attachments.filter(a => getAttachmentCategory(a) === 'other'); const otherAttachments = attachments.filter(a => getAttachmentCategory(a) === 'other');
const diffs = groupImageDiffs(screenshots); const diffs = groupImageDiffs(screenshots);
return { screenshots: [...screenshots], videos, traces, otherAttachments, diffs, htmls }; return { screenshots: [...screenshots], videos, traces, otherAttachments, diffs, htmls };
}, [result]); }, [result.attachments]);
const videoRef = React.useRef<HTMLDivElement>(null); const videoRef = React.useRef<HTMLDivElement>(null);
const imageDiffRef = React.useRef<HTMLDivElement>(null); const imageDiffRef = React.useRef<HTMLDivElement>(null);