Describe the bug
I have a useQuery hook from my router , and I'm passing the result of that into a useCallback, and the no-unstable-deps rule is flagging it as unstable, even though it's not.
eg:
import { useQuery } from './router';
function SomeComponent() {
const query = useQuery();
const onChange = useCallback((selection: string) => {
setRoute({
query: {
...query,
selection,
},
})
}, [query])
// ^ eslint warning about useQuery result not being referentially stable
return <></>
}
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/elated-sun-nh3m34 (worth noting, I couldn't get eslint working in CSB, so it's just a code reference)
Steps to reproduce
- Have an existing
useQuery hook that is not from Tanstack query
- Use the return value of that hook as a dependency in a hook that has a dependency array (useEffect, useMemo, useCallback, etc)
Expected behavior
As a user, I would not expect an error here, since the return value of my hook may be referentially stable. Errors should only show up if the useQuery is imported form Tanstack query.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
N/A
- @tanstack/eslint-plugin-query: 5.91.2
- eslint: 9.32.0
Tanstack Query adapter
react-query
TanStack Query version
v5.90.2
TypeScript version
v5.4.5
Additional context
No response
Describe the bug
I have a
useQueryhook from my router , and I'm passing the result of that into a useCallback, and theno-unstable-depsrule is flagging it as unstable, even though it's not.eg:
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/elated-sun-nh3m34 (worth noting, I couldn't get eslint working in CSB, so it's just a code reference)
Steps to reproduce
useQueryhook that is not from Tanstack queryExpected behavior
As a user, I would not expect an error here, since the return value of my hook may be referentially stable. Errors should only show up if the useQuery is imported form Tanstack query.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
N/A
Tanstack Query adapter
react-query
TanStack Query version
v5.90.2
TypeScript version
v5.4.5
Additional context
No response