From 19b433baa5cb732b21d2477dc5f1b7ab2481a203 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 13 Jan 2025 13:32:51 +0100 Subject: [PATCH] Moved setter back up because of freezing --- front/components/data_source/MultipleDocumentsUpload.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/components/data_source/MultipleDocumentsUpload.tsx b/front/components/data_source/MultipleDocumentsUpload.tsx index 4eeeeb10a645..99098e01cdb5 100644 --- a/front/components/data_source/MultipleDocumentsUpload.tsx +++ b/front/components/data_source/MultipleDocumentsUpload.tsx @@ -152,9 +152,11 @@ export const MultipleDocumentsUpload = ({ const { droppedFiles, setDroppedFiles } = useFileDrop(); useEffect(() => { const handleDroppedFiles = async () => { - await uploadFiles(droppedFiles); + // Avoid race condition with the file input + const droppedFilesCopy = [...droppedFiles]; // Make sure the files are cleared after processing setDroppedFiles([]); + await uploadFiles(droppedFilesCopy); }; void handleDroppedFiles(); }, [droppedFiles, setDroppedFiles, uploadFiles]);