tRPC useQuery waits for all queries—How to render ASAP?
I have a dashboard with multiple components, each making its own useQuery call. The problem: It waits for all queries to load before rendering anything, instead of displaying data as soon as it's ready.
🔹 Setup:
- trpc.createClient with httpBatchLink
- Each component has its own independent useQuery()
- No Promise.all(), no global Suspense
Solution:Jump to solution
Ok I found the solution, I switched to « httpLink » instead of « httpBatchLink » in my trpc client
3 Replies
It does sound like you have something global (or at least parented to your components) going on, useQuery should absolutely come back granularly
Sure you don't have a single suspense query which runs longest of all?
I checked and I don't have any Suspense in my app ... I only use "isLoading" to display loader
Solution
Ok I found the solution, I switched to « httpLink » instead of « httpBatchLink » in my trpc client