useQuery not changing variables on retrying in case of error #8167
Unanswered
singhayush1403
asked this question in
Q&A
Replies: 1 comment
-
you are closing over the you’d want to either add everything you use in the queryFn to the queryKey (we have a lint rule for that), or, in terms of authToken, it’s probably better to imperatively read it in the queryFn / on your fetch layer.
|
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
-
Describe the bug
I am using this query for an API call which uses an authToken, accessed using the useAuth hook. The authtoken expires in a fixed amount of time, so if the API returns token expired, I refetch the authToken and then the retry happens. The authToken is being updated, but the query is being retried with the old token.
Your minimal, reproducible example
No example
Steps to reproduce
no repro
Expected behavior
The query should be retried using the new authToken
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
v4.16.1
TypeScript version
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions