We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@tanstack/query/exhaustive-deps
<script setup lang="ts"> import { reactive } from 'vue'; import { useQuery } from '@tanstack/vue-query'; const obj = reactive<{ foo?: string }>({}); const query = useQuery({ queryKey: ['demo', () => obj.foo], // queryKey: ['demo', () => obj.foo, obj.foo], <== no error, but redundant queryFn: () => fetch(`/mock/getSomething/${obj.foo}`), enable: () => !!obj.foo, }); </script>
For codes like above, @tanstack/query/exhaustive-deps rule will throw an error:
The following dependencies are missing in your queryKey: obj.foo
https://stackblitz.com/edit/vitejs-vite-ucguwp?file=src%2FApp.vue
pnpm run lint
Is it possible to see getter as a dep in queryKey, or we can only wrap it in computed to escape this error?
<script setup lang="ts"> import { reactive } from 'vue'; import { useQuery } from '@tanstack/vue-query'; const obj = reactive<{ foo?: string }>({}); const foo = computed(() => obj.foo); const query = useQuery({ queryKey: ['demo', foo], queryFn: () => fetch(`/mock/getSomething/${foo.value}`), enable: () => !!foo.value, }); </script>
None
No response
Not related
v5.57.1
The text was updated successfully, but these errors were encountered:
fix(eslint-plugin-query): handle callable params within exaustive-dep…
d82a448
…s rule Closes TanStack#8093
Hi @Jungzl I've just raised a PR for this issue. If it is ok, should get merged soon I guess.
Sorry, something went wrong.
eb2f9d3
Successfully merging a pull request may close this issue.
Describe the bug
For codes like above,
@tanstack/query/exhaustive-deps
rule will throw an error:The following dependencies are missing in your queryKey: obj.foo
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-ucguwp?file=src%2FApp.vue
Steps to reproduce
pnpm run lint
Expected behavior
Is it possible to see getter as a dep in queryKey, or we can only wrap it in computed to escape this error?
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Not related
Tanstack Query adapter
None
TanStack Query version
v5.57.1
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: