T
TanStack3y ago
eastern-cyan

(Vue) useQueries question

Hi, is there a way to refetch useQueries on key change?
4 Replies
generous-apricot
generous-apricot3y ago
If I'm not mistaken it should work. If it does not then it's potentially a bug. Could you provide a minimal reproduction repo or sandbox?
eastern-cyan
eastern-cyanOP3y ago
Hi. Maybe I don't know how to useQueries correctly, here is minimal reproduction code https://stackblitz.com/edit/vue3-script-setup-with-vite-juxegq?file=src%2FQueriesComponent.vue I have found workaround by using useQueryClient, forEach + fetchQuery over array of queries, and watch for dependencies
generous-apricot
generous-apricot3y ago
So, this seems to be working fine for me: https://stackblitz.com/edit/vue3-script-setup-with-vite-vzy9xf?file=package.json,src%2FApp.vue,src%2FQueriesComponent.vue To see the devtools - install official vue devtools, click open in new tab, open chrome devtools, click on vue tab
correct-apricot
correct-apricot3y ago
I am also having difficulty here - but a little more complex so i am sure its something I am doing wrong I have a component which is passed a value via a prop that prop is part of the key, I cannot get it to refetch unless i remove .value in the key, at which point it refetches loads as the object is changing Holy sheeeet, wasn't using toRefs

Did you find this page helpful?