blitz icon indicating copy to clipboard operation
blitz copied to clipboard

Add useQueries hook

Open flybayer opened this issue 2 years ago • 9 comments

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

flybayer avatar Sep 08 '21 22:09 flybayer

i can take care of this one +1:

@flybayer

karimsx avatar Sep 12 '21 07:09 karimsx

@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

flybayer avatar Sep 21 '21 16:09 flybayer

@karimsx Did you ever look into this? Thanks

paulm17 avatar Feb 20 '22 11:02 paulm17

sorry guys i was a little busy, i will look into this this week

karimsx avatar Jul 10 '22 13:07 karimsx

@karimsx Awesome. Let me know if there is anyway I can test for you. I have an exact use case for this.

paulm17 avatar Jul 10 '22 13:07 paulm17

@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 avatar Jul 15 '22 16:07 paulm17

@paulm17 i did take a look, but i'm enought experienced to implement it, still trying but its a little hard

karimsx avatar Jul 19 '22 18:07 karimsx

@karimsx Same here! 😓

All you need to do, is port over: https://github.com/TanStack/query/blob/v3/src/react/useQueries.ts ?

paulm17 avatar Jul 19 '22 18:07 paulm17

@karimsx @paulm17 I didn't look into it very closely but I guess there would be two things needed:

  1. Port over the logic from react-query (what @paulm17 mentioned)
  2. 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.

beerose avatar Jul 20 '22 12:07 beerose