-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
I recently installed the plugin and started using the recommended rules but it flagged a bunch of false positives.
When using an object of data within useQuery, we sometimes pass the whole object to the queryKey, but the eslint plugin says some items are missing from the queryKey.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/vibrant-voice-fktju6?welcome=true&file=%2FREADME.md
Steps to reproduce
open the terminal and run npm run lint and see errors in the terminal.
Expected behavior
I'd expect this to work the same as a useEffect dependency array, allowing passing the object to the array and removing warnings, But I'm seeing it asking for additional items in the array.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
macOS
in vscode (and codesandbox)
TanStack Query version
v4.22.0
TypeScript version
^4.9.4
Additional context
No response
edit:
I also notice, if I do add state.id to the query key, the warning goes away, but I'm still using 2 other items from state in the query function and am not getting any errors anymore! (maybe this is more problematic than the original issue??)
