Skip to content

Commit

Permalink
Moved setter back up because of freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
overmode committed Jan 13, 2025
1 parent 94c2ee6 commit 19b433b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion front/components/data_source/MultipleDocumentsUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 19b433b

Please sign in to comment.