smeijer/spin-delay

[Feature Request]: Delay mutations

Haberkamp opened this issue · 1 comments

Hey, thanks for the cool library. I wonder if it makes sense to also support delaying mutations. I.e. always showing the spinner for at least 300ms, like in this example? I'd be willing to contribute a PR.

Sorry, I'm not sure if I understand, but are you not just looking for delay: 0 combined with a minDuration: 300 ? This forces a spinner to show up immediately, and remain visible for at least 300ms.

const showSpinner = useSpinDelay(loading, { delay: 0, minDuration: 300 });