react query useMutation does not retry with updated state
Quick question, useMutation when it is retrying doesnt update the state, see below:
As in, the accessToken updates in the state before the retry, but the query retries using the original state (and original access token), therefore permanently being unauthorized. How can i make it run the retry with the UPDATED access token/
3 Replies
fascinating-indigo•3y ago
As far as I know a retry will retry the same request. If you want to make a mutation with different variables (a different access token) then I think it’d be considered a new mutation.
Did you look at using request interceptors out of interest?
xenogeneic-maroonOP•3y ago
yep thats the road im probably gonna go down
just figured itd be easier to not rewrite a bunch of stuff if i didnt have to
but its been a pain tryna take the easy route
fascinating-indigo•3y ago
I think it’d be simpler
Let us know if you get stuck :reactquery: