Skip to content
Discussion options

You must be logged in to vote

My first thoughts are:

  • yes, the second query should be dependent on the existence of an ID in the result of the first query. Use the enabled option for that.
  • sounds also good to me! Using the retry function seems nice, but your queryFn needs to throw an error for that. Your query will be in loading state until you get a valid result, so you can’t differentiate between loading and pending with that approach I think. If you want that, i think moving the success/pending state to a local useState (write to the state in onSuccess) and then enable refetchInterval depending on it would work.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by rasmusfiskerbang
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