From 6cc53907b8da32e0bbd5885cb7b0efd8c889f200 Mon Sep 17 00:00:00 2001 From: Marko Haarni Date: Wed, 1 Nov 2023 13:00:37 +0200 Subject: [PATCH] fixup! HAI-2065 Implement file upload component --- src/common/components/fileUpload/utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/components/fileUpload/utils.ts b/src/common/components/fileUpload/utils.ts index 906d96a41..2d0fa1236 100644 --- a/src/common/components/fileUpload/utils.ts +++ b/src/common/components/fileUpload/utils.ts @@ -2,14 +2,14 @@ import { AttachmentMetadata } from '../../types/attachment'; // Filter out duplicate files based on file name export function removeDuplicateAttachments( - files: File[], - attachments: T[] | undefined, + addedFiles: File[], + existingAttachments: T[] | undefined, ): [File[], File[]] { - const duplicateFiles = files.filter( - (file) => attachments?.some((attachment) => attachment.fileName === file.name), + const duplicateFiles = addedFiles.filter( + (file) => existingAttachments?.some((attachment) => attachment.fileName === file.name), ); - const newFiles = files.filter( - (file) => attachments?.every((attachment) => attachment.fileName !== file.name), + const newFiles = addedFiles.filter( + (file) => existingAttachments?.every((attachment) => attachment.fileName !== file.name), ); return [newFiles, duplicateFiles]; }