-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Describe the bug
Related to #5196
Incorrect exhaustive-deps error for constant values when using them in an external function to define the query
(ApiRoutes is an external enum)
Steps to reproduce
Use constants values in an external function outside useQuery
const Ab = 1
// This throws the error
function groupsQuery() {
return {
queryKey: ['get-groups'],
queryFn: () => Ab,
}
}
// This works
function useGroups() {
return useQuery({
queryKey: ['get-groups'],
queryFn: () => Ab,
})
}
Expected behavior
Constants used in external functions should not count as a dependency
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: MacOS
- VSCode
Tanstack Query adapter
react-query
TanStack Query version
v4.29.5
TypeScript version
No response
Additional context
Using @tanstack/eslint-plugin-query
in v4.29.8