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]);