Stop refresh interval after so many retries or on certain error
I want to stop refreshing I get 500 errors, or at least have a way to distinguish between retries/refreshes in the onError callback.
5 Replies
rising-crimson•4y ago
refetchInterval can take a function for exactly this purpose.
funny-blueOP•4y ago
but the function only gets the old data as an argument. Not the error/retries
rising-crimson•4y ago
it gets passed the whole
query as a second parameter, which contains the error as well.funny-blueOP•4y ago
ooooh! I thought that would just be the query key and other options. thanks!!
rising-crimson•4y ago
query.state.error is what you're looking for.