4 ms·
There should be a short delay (200ms to 500ms) before showing a loading spinner, and if the operation completes in that time you can avoid showing it at all. Bu
by frosted-flakes 4y ago
There should be a short delay (200ms to 500ms) before showing a loading spinner, and if the operation completes in that time you can avoid showing it at all. But if it takes longer than that, the spinner should be shown for a minimum of 500ms or so, to avoid a sudden flash of the spinner.
I wrote a React hook called usePending[1] for this once. It's surprisingly difficult to get right.
[1] https://gist.github.com/cmmartti/4f7833292b9d277685fc08135326e8a3 https://gist.github.com/cmmartti/4f7833292b9d277685fc0813532...
- ketzo 4y agowow, wait, this is awesome. I think I might drop this in instead. thank you!