You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User tries to upload a single '.png' file. It will get rejected, setting the rejected variable by onReject
User uploads only '.pdf' files. This will only call onDrop since user did only upload valid files.
Problem
The final state of accepted and rejected do not reflect the last user drop
Solution
Add a new prop to the Dropzone called something like onDropAny that gets both accepted and rejected files. react-dropzone already provides this functionality so it should be easy to implement.
(it is called onDrop on the useDropzone hook)
This would make it possible to update the state of both accepted and rejected on the same function, guaranteeing to be able to set the state of the last user interaction
I am currently trying this on a fork!
This PR shows a way that this could be implemented: #3010
The text was updated successfully, but these errors were encountered:
nicolassanmar
changed the title
Dropzone: Get both rejected and accepted files on the same callback function
Dropzone: Rejected and accepted files on the same callback function (Proposed fix)
Nov 19, 2022
Context
Consider the following scenario, where a user uploads files to a dropzone and we want to keep track of the uploaded files:
Problematic scenario
rejected
variable byonReject
onDrop
since user did only upload valid files.Problem
The final state of
accepted
andrejected
do not reflect the last user dropSolution
Add a new prop to the
Dropzone
called something likeonDropAny
that gets both accepted and rejected files.react-dropzone
already provides this functionality so it should be easy to implement.(it is called
onDrop
on theuseDropzone
hook)This would make it possible to update the state of both
accepted
andrejected
on the same function, guaranteeing to be able to set the state of the last user interactionI am currently trying this on a fork!
This PR shows a way that this could be implemented:
#3010
The text was updated successfully, but these errors were encountered: