Is it possible to have a minimum loading time for useMutation hook? #5427
Replies: 1 comment
-
to avoid a flashing loading indicator, I ended up using a hook for that. const { isLoading: isLoadingOG, ...rest } = useMutation(/* .... */)
const isLoading = useThrottle(isLoadingOG, 500); // <---- like so. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using the
useMutation
hook something like this:Problem is sometimes, the mutation takes time, which is fine but other times, it happens quickly, so the loading indicators I have setup using the
isLoading
for button ends up being a flash which is bad for user experience.I am looking for a way to keep the
isLoading
state up for atleast 1 second for each mutation.Is that possible without relying on
window.setTimeout
?Beta Was this translation helpful? Give feedback.
All reactions