react-filepond icon indicating copy to clipboard operation
react-filepond copied to clipboard

Custom hook does not work with ```beforeAddFile```

Open kevinntruo opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Have you updated React FilePond, FilePond, and all plugins?

  • [x] I have updated FilePond and its plugins

Describe the bug

I have created a useConfirm hook that returns a Promise by opening a dialog. This works for beforeRemoveFile but not beforeAddFile. Is this expected? Besides, is there a way to use useConfirm before the file processes (aka. before uploading to the server)?

Reproduction

I have composed a CodeSandBox for demo purposes.

https://codesandbox.io/s/musing-kare-x82m3p?file=/src/Upload.js

Environment

- OS: Windows 10
- Browser: Chrome
- React version: 17.0.2

kevinntruo avatar Apr 18 '22 16:04 kevinntruo

To be honest, I'm not sure what's going on. If I comment out the files / onupdatefiles block, it works as expected.

It seems that setting the files property is somehow connected to this but I don't know why that would make a difference.

rikschennink avatar Apr 19 '22 14:04 rikschennink

Hi @rikschennink, thank you for your response. I would never have thought commenting out the files / onupdatefiles block would work. I'll take a look at this in my free time.

kevinntruo avatar Apr 19 '22 15:04 kevinntruo