Cannot remove last file using the useControl
hook
#975
Answered
by
edmundhung
hunterbecton
asked this question in
Q&A
-
I'm building a dropzone component, and you can find a minimal example here: https://stackblitz.com/edit/stackblitz-starters-wzblhy3p?file=app%2Fpage.tsx My goal is to use the component with the To reproduce:
Does anyone know why this is happening? |
Beta Was this translation helpful? Give feedback.
Answered by
edmundhung
Jul 3, 2025
Replies: 1 comment 1 reply
-
Thanks for the repo. I find the issue and I will put up a fix later today. A quick workaround before the fix is landed: <FileUpload
accept="image/*"
maxFiles={5}
multiple
onValueChange={(newFiles) => {
// @ts-expect-error control.change should accept null
control.change(newFiles.length > 0 ? newFiles : null);
}}
value={control.files}
/> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be fixed in v1.8.1. You can continue passing an array to
control.change()
now: