Make useQuery re-run when refs change
Hello, i'm a React developer trying to get the hang of using vue-query with Vue
Is there any example out there showcasing how do i go about making useQuery fire again when one of my refs change?
Do i have to call it once inside the
setup
function and then again within the onUpdated
lifecycle hook?
I am pretty confused,
Thanks in advance4 Replies
variable-lime•3y ago
No, just pass a ref to
queryKey
without unwrapping.
So do not do queryKey: [myref.value]
, do queryKey: [myref]
. vue-query will handle the rest for yousecure-lavenderOP•3y ago
Holy fk, you're a legend. Is this mentioned anywhere in the docs?
What i actually did to make it work before, was to wire up the refs with
computed
and then feed them into my queryvariable-lime•3y ago
I beleive it was mentioned in the old docs, but got lost in the new one. I need to make the pass trough the docs to add it back.
secure-lavenderOP•3y ago
Thanks for taking the time to respond. I appreciate it