Feature request: Allow some variable names from @tanstack/query/exhaustive-deps #7276
-
|
I normally create custom hooks that return queries that depends on other values, like an authentication token. I use the authentication token in queryFn but then the eslint rule @tanstack/query/exhaustive-deps requires the token to be in the query key, which is not good once authentication tokens are not supposed to be part of a query key. It would be good to configure the rule with a list of allowed names to not require them in the queryKey, like |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
if your code looks like this: then the rule is technically correct because you are closing over The real question is: Why is but ideally, all of this would live outside of react ... |
Beta Was this translation helpful? Give feedback.
-
|
I think this is addressed by #10295 ? |
Beta Was this translation helpful? Give feedback.
-
|
We also have a usecase for this: We manage our http environment with react providers. e.g. for dynamic auth szenarios After the latest tanstack query update we got a list with >100 warnings. |
Beta Was this translation helpful? Give feedback.
I think this is addressed by #10295 ?