Replies: 1 comment 1 reply
-
I think you can combine it with spin-delay package to achieve this in a few lines of code: let globalState = useGlobalPendingState()
let isPending = showSpinner = useSpinDelay(globalState !== "idle", {
delay: 500, minDuration: 200
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use the
useGlobalPendingState
hook in combination with https://github.com/frysztak/use-debounced-loader that let's me compute a derived loading state with aninitialDelay
andminimalTimeOn
. This helps avoiding flickering spinners that are only displayed for a very short time.It would be nice if the
useGlobalXxxSate
hooks could provide this functionality directly as optional parameters, e.g.const state = useGlobalPendingState({initialDelay: 150, minimalTimeOn: 250})
.Beta Was this translation helpful? Give feedback.
All reactions