blitz
blitz copied to clipboard
Add useQueries hook
What do you want and why?
React-query has a useQueries hook that we need to add support for.
Possible implementation(s)
API like this:
import {useQueries} from 'blitz'
const results = useQueries([
[getPost, {id: 1}],
[getPost, {id: 2}],
])
Here's the file that has our react-query hooks: https://github.com/blitz-js/blitz/blob/canary/nextjs/packages/next/data-client/react-query.tsx
i can take care of this one +1:
@flybayer
@karimsx awesome! Sorry for delay in responding here, you don't have to wait for confirmation if it's labeled status/ready-to-work-on
@karimsx Did you ever look into this? Thanks
sorry guys i was a little busy, i will look into this this week
@karimsx Awesome. Let me know if there is anyway I can test for you. I have an exact use case for this.
@karimsx Sorry to keep pestering you about this. Did you look into it? If you don't mind. I'd like to take a stab at it. I just don't want to duplicate work. 😄
@paulm17 i did take a look, but i'm enought experienced to implement it, still trying but its a little hard
@karimsx Same here! 😓
All you need to do, is port over: https://github.com/TanStack/query/blob/v3/src/react/useQueries.ts ?
@karimsx @paulm17 I didn't look into it very closely but I guess there would be two things needed:
- Port over the logic from
react-query
(what @paulm17 mentioned) - Do something similar to the
useQuery
implementation: https://github.com/blitz-js/blitz/blob/d7119488097cfc0e1acb80d9f124df49152743cc/packages/blitz-rpc/src/data-client/react-query.tsx#L39, so that it works with blitz rpc/auth etc.