Replies: 1 comment
-
One way would be to get the I would rather make a subscription to the query cache and look at the
put that in a useEffect and you're good to go |
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
-
I have the following code to show a retry toast -
Unfortunately, I cannot identify the query key for which the retry progresses. I'd like to show a descriptive message to let the user know via toast as to retry for which fetch is in progress. Yes, we can individually do this for every query but it would be great to handle this via defaultOptions.
At present, I am also clearing toasts without knowing for which fetch is it being showing. So, I end up showing one retry but it would be great to only clear it on the basis of the query key. So, let's say if queryKey1 resolved, we still show retrying for queryKey2 if it's running. At present, I am not sure how to achieve that under defaultOptions. I could have created a map of query keys if the query param was available through the retry handler.
Let me know if this can be done via
defaultOptions
and if I am missing something.The solution would be to have a query as a third parameter of the retry handler like onSuccess and onError. Something like -
retry(failureCount, error, query)
Beta Was this translation helpful? Give feedback.
All reactions