vue-query
vue-query copied to clipboard
useQueries doesn't seem to unpack deep ref options
I mean, I can do it myself, but I thought vue-query was made to do it for me. It works with the normal useQuery().
So I'm talking about the enabled option for example. Which can be a ref or a computed and then when you use it in useQuery() then it automatically unwraps the ref/computed. But when I use it in useQueries() I get an error from react-query that enabled is not a boolean and indeed, when I check, it is indeed still a computed.
Oh yeah I'm using version 1.25.2 btw.
Well,
In v1 only useQuery/useInfiniteQuery unwrap refs automatically.
In v2 all composables besides useQueries.
So it is something that needs to be added and possibly back ported to v1
I think so, personally. Like it's just strange that useQuery() would cloneDeepUnref the options, but useQueries() wouldn't. And unfortunately you don't export cloneDeepUnref, so now I have to copy that function to my own src folder.
The idea is not to implement it on your side, but contribute to the repository and add a support for it for everyone to use 😉
@Evertt Try https://github.com/DamianOsipiuk/vue-query/releases/tag/v1.26.0
I tried, and at first it seemed to work, but later it seemed like the attributes that I get back every query, like data, stopped being reactive. So I went back to 1.25 and my previous workaround. 😬
Edit
Wait, that's not precise enough. If I asked for the data attribute of one of those queries immediately on page load, then it would work. But I also have a popover element, which means that when I hover over an element, a new component appears, that uses the same list of useQueries() as the first component did. But it gets a different query (at a different index in the list) and then the data attribute of that query isn't reactive for some reason.
While it was reactive while I was using my workaround. 😅
Few question:
- could you check if with the latest version you are passing
queriesarray asreactive? - is is possible that your workaround stabilized the queries order in the array?
- what Vue version are you using?
This should be fixed in @tanstack/vue-query