Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom hook does not work with beforeAddFile #208

Open
2 tasks done
kevinntruo opened this issue Apr 18, 2022 · 2 comments
Open
2 tasks done

Custom hook does not work with beforeAddFile #208

kevinntruo opened this issue Apr 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@kevinntruo
Copy link

kevinntruo commented Apr 18, 2022

Is there an existing issue for this?

  • I have searched the existing issues

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

  • 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 kevinntruo added the bug Something isn't working label Apr 18, 2022
@rikschennink
Copy link
Collaborator

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.

@kevinntruo
Copy link
Author

kevinntruo commented Apr 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants