Skip to content

Commit

Permalink
fix(file-upload): useEffect calls may only return a 'cleanup' funct…
Browse files Browse the repository at this point in the history
…ion or undefined
  • Loading branch information
Lordfirespeed committed Sep 29, 2024
1 parent a97c31d commit df5ab54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/ui/file-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ const FileUpload = ({ className, children, dropzoneOptions, onChange, files: _fi
const [files, setFiles] = React.useState<File[]>(_files ?? [])
const [errorMessages, setErrorMessages] = React.useState<string[]>([])

React.useEffect(() => onChange(files), [files])
React.useEffect(() => {
onChange(files)
return undefined
}, [files])

const onDrop = React.useCallback<Exclude<ReactDropzoneOptions["onDrop"], undefined>>((acceptedFiles, fileRejections, event) => {
dropzoneOptions?.onDrop?.(acceptedFiles, fileRejections, event)
Expand Down

0 comments on commit df5ab54

Please sign in to comment.