-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Describe the bug
Usage of the following syntax does not trigger an error from "@tanstack/query/exhaustive-deps"
:
const id = "foo";
useQuery({
queryKey: ["deps"],
queryFn() {
return id;
}
});
What I have found is this syntax trigger an error:
const id = "foo";
useQuery({
queryKey: ["deps"],
queryFn: () => {
return id;
}
});
Your minimal, reproducible example
https://codesandbox.io/p/devbox/fancy-lake-hymxyk
Steps to reproduce
- Go to https://codesandbox.io/p/devbox/fancy-lake-hymxyk
- Fork
- Open a new Terminal
- Run
yarn eslint src/index.jsx
Expected behavior
Expected output:
yarn run v1.22.19
$ /workspace/node_modules/.bin/eslint src/index.jsx
/workspace/src/index.jsx
25:5 error The following dependencies are missing in your queryKey: endpoint @tanstack/query/exhaustive-deps
✖ 1 problem (1 error, 0 warnings)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Any
Tanstack Query adapter
react-query
TanStack Query version
v5.28.6
TypeScript version
v5.3.0
Additional context
No response