How to cancel polling on Button click #5796
Replies: 1 comment
-
You can have a state to track the refetch status, then use it in the refetchInterval function to decide to stop the polling.
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have logic to stop the polling from within the query
refetchInterval: (data) => data?.status_code === 'SUCCESS' ? false : 5000
But how to stop the polling in some other component when a Button is clicked. I tried this
queryClient.cancelQueries({ queryKey: ['runStatus'] })
but somehow the polling still continues.
Beta Was this translation helpful? Give feedback.
All reactions