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
Thanks for the great library. Just been trying to put an overlay type dropzone together that appears over the top of a form on drag. In order to do this I needed to control the display of the dropzone component with some state change. All good there so far.
I'm listening to the drag enter, drag leave events on the form so as to swicth dropzone on and off. That all works fine if I haven't dropped any files in the zone. Once I do this, the drag leave is never fired (to be expected).
What I wanted to do was listen to the 'removed' event and if there are no files left, then I'll trigger my state change to hide the dropzone and display the form again.
The trouble is that when onStateChanged is fired for the remove event, it is done, before the file is removed from the files array. Sort of feels like if the event is 'removed' then the files array passed to onStatusChange should reflect the files without the last removed element.
see here this.files.splice(index, 1) is called after this.handleChangeStatus(fileWithMeta).
Is there a particular design reason why it's not removed first? If not I'm happy to submit a PR if you are happy to take one?
Cheers
Paul
The text was updated successfully, but these errors were encountered:
fridaystreet
changed the title
array of files passed to onStatusChange is updated after handler is fired for 'removed'
files array passed to onStatusChange is updated after handler is fired for 'removed'
Sep 18, 2020
Thanks for the great library. Just been trying to put an overlay type dropzone together that appears over the top of a form on drag. In order to do this I needed to control the display of the dropzone component with some state change. All good there so far.
I'm listening to the drag enter, drag leave events on the form so as to swicth dropzone on and off. That all works fine if I haven't dropped any files in the zone. Once I do this, the drag leave is never fired (to be expected).
What I wanted to do was listen to the 'removed' event and if there are no files left, then I'll trigger my state change to hide the dropzone and display the form again.
The trouble is that when onStateChanged is fired for the remove event, it is done, before the file is removed from the files array. Sort of feels like if the event is 'removed' then the files array passed to onStatusChange should reflect the files without the last removed element.
see here this.files.splice(index, 1) is called after this.handleChangeStatus(fileWithMeta).
Is there a particular design reason why it's not removed first? If not I'm happy to submit a PR if you are happy to take one?
Cheers
Paul
The text was updated successfully, but these errors were encountered: