by mywacaday · 3y ago · 0 comments
I wrote a React hook called usePending[1] for this once. It's surprisingly difficult to get right.
[1] https://gist.github.com/cmmartti/4f7833292b9d277685fc0813532...
but it's an async process that could take longer, so then you get into "well if it's <200ms we won't show a spinner, but if it takes longer we will..."
it's a settings page where you're clicking toggles, and each toggle saves automatically when you hit it. so when you click one, you get a short spinner, then a check mark when it succeeds. feels right to me when I'm using it