haradakunihiko / react-confirm

Small library which makes your Dialog component callable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timeout?

mpobrien opened this issue · comments

I noticed that there's a hardcoded 1-second timeout when proceed is fired:

https://github.com/haradakunihiko/react-confirm/blob/master/src/createConfirmation.js#L29

Is there any specific reason for using a delay here? It seems to make the confirmation feel a little sluggish/unresponsive. I think it would make more sense to default to having it proceed with no delay, especially because the user could, if truly desired, work in their own setTimeout call around the proceed callback in their own component's code.
Or, if a delay really does make sense somehow, it should be easy to override this with a config option; the hardcoding is a bit restrictive :)

I'm happy to work on this and submit a PR if that approach sounds reasonable.

Yes, your are right. Technically there is no reason for this delay.
The reason why I set delay is that some dialog component disappears with some delay and they sometimes do not provide any event or callback function to be triggered/called after the DOM really disappeared.

But again, you right. I think config option is reasonable because I do not want to change the default behavior. I appreciate if you make a PR for this issue.