Skip to content
Discussion options

You must be logged in to vote

@pdhruv93 Did you try using a shared state between the cancel button component and the one executing the polling? That is, adding that shared value to your condition:

(data) => {
  if(data?.status_code === 'SUCCESS' || sharedValue) {
    return false
  }
  return 1000 * 5
}

Nonetheless this would make your refetchInterval callback an impure function stopping the polling based on an external value not present into your data object, so you can use the meta option to pass that sharedValue and extract it from inside your refetchInterval callback through the query object that is the second parameter received by your refetchInterval callback:

(data, query) => {
  if(data?.status_code === 'SUCC…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pdhruv93
Comment options

Answer selected by pdhruv93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants