From 3ec83e33e0c9b506887f4442b4f8a729b5682b70 Mon Sep 17 00:00:00 2001 From: viet nguyen Date: Mon, 9 Oct 2023 17:44:09 -0700 Subject: [PATCH] fix: restore await on multiple photo uploads --- src/js/hooks/usePhotoUploader.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/hooks/usePhotoUploader.tsx b/src/js/hooks/usePhotoUploader.tsx index 7556c5e1a..13006ad46 100644 --- a/src/js/hooks/usePhotoUploader.tsx +++ b/src/js/hooks/usePhotoUploader.tsx @@ -93,12 +93,12 @@ export default function usePhotoUploader (): PhotoUploaderReturnType { } } - const onDrop = (files: File[], rejections: FileRejection[]): void => { + const onDrop = async (files: File[], rejections: FileRejection[]): Promise => { if (rejections.length > 0) { console.warn('Rejected files: ', rejections) } setUploading(true) ref.current.hasErrors = false - void Promise.all(files.map(async file => { + await Promise.all(files.map(async file => { if (file.size > 11534336) { toast.warn('¡Ay, caramba! one of your photos is too cruxy (please reduce the size to 11MB or under)') return true @@ -125,6 +125,7 @@ export default function usePhotoUploader (): PhotoUploaderReturnType { } const { getRootProps, getInputProps, open } = useDropzone({ + /* eslint-disable-next-line */ onDrop, multiple: true, // support many // When I get back from climbing trips, I have a huge pile of photos