T
TanStack2y ago
extended-salmon

While a query is disabled it still creates entries in the query cache

I noticed that even if a query is set to enabled: false it still creates entries in the query cache when the query key changes. Is that the desired behavior or am I doing something wrong?
6 Replies
extended-salmon
extended-salmonOP2y ago
I have create a Stackblitz here to showcase what I mean https://stackblitz.com/edit/vite-vue3-ts-tailwind-mdfjg2?file=src%2Fpages%2FHome.vue
Giannis Koutsaftakis
StackBlitz
Vue query - disabled query - StackBlitz
Next generation frontend tooling. It's fast!
extended-salmon
extended-salmonOP2y ago
You'll see that the cache gets populated with empty entries when you increment the counter even if the query is disabled
No description
fair-rose
fair-rose2y ago
yes, it's the desired behaviour.
unwilling-turquoise
unwilling-turquoise2y ago
Yes. This only disabled calling the queryFn
extended-salmon
extended-salmonOP2y ago
@M00LTi can you elaborate more?
ambitious-aqua
ambitious-aqua2y ago
By using useQuery you create the observer that watches cache store. Even if it's disabled you want to be updated when another component has the same query enabled, or you call queryClient.setQueryData.

Did you find this page helpful?