Skip to content

Commit

Permalink
wait for file to be read before deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
FarazPatankar committed Jul 6, 2022
1 parent 6652a3c commit 48987fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Dropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export const Dropzone: React.FC<DropzoneProps> = ({ setImage }) => {

setImage(assetUrl);

/**
* Wait here to ensure the file has been read
* before removing it.
*/
await new Promise(resolve => setTimeout(resolve, 1500));

await removeFile(filepath);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit 48987fc

Please sign in to comment.