Thomas
Thomas•4w ago

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:
Ok I found the solution, I switched to « httpLink » instead of « httpBatchLink » in my trpc client
Jump to solution
3 Replies
Nick
Nick•4w ago
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?
Thomas
ThomasOP•4w ago
I checked and I don't have any Suspense in my app ... I only use "isLoading" to display loader
Solution
Thomas
Thomas•4w ago
Ok I found the solution, I switched to « httpLink » instead of « httpBatchLink » in my trpc client

Did you find this page helpful?