From df5ab5494a4cc8a859db9654f11a018b08d4c5eb Mon Sep 17 00:00:00 2001 From: Lordfirespeed <28568841+Lordfirespeed@users.noreply.github.com> Date: Sun, 29 Sep 2024 21:19:16 +0100 Subject: [PATCH] fix(file-upload): `useEffect` calls may only return a 'cleanup' function or undefined --- src/components/ui/file-upload.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ui/file-upload.tsx b/src/components/ui/file-upload.tsx index 014cbee..3c22ca5 100644 --- a/src/components/ui/file-upload.tsx +++ b/src/components/ui/file-upload.tsx @@ -46,7 +46,10 @@ const FileUpload = ({ className, children, dropzoneOptions, onChange, files: _fi const [files, setFiles] = React.useState(_files ?? []) const [errorMessages, setErrorMessages] = React.useState([]) - React.useEffect(() => onChange(files), [files]) + React.useEffect(() => { + onChange(files) + return undefined + }, [files]) const onDrop = React.useCallback>((acceptedFiles, fileRejections, event) => { dropzoneOptions?.onDrop?.(acceptedFiles, fileRejections, event)