Kamil
Mocking tRPC in Storybook
Anybody have working Storybook mock with latest tRPC in Next.js?
I found some MSW integration but I can't get it working. Also the integration seems a bit off.
Ideally I'd like to be able to define mock per story. Any advices?
2 replies
How to properly handle errors on the client
I throw
TRPCError
error in the procedure under certain conditions. On the client I query the procedure and check the error with isError
flag returned by hook.
The problem is it bubbles the error to the very top crashing entire application. How to stop it bubbling and make it catchable with isError
flag? The documentation is poor about handling errors on the client.
It's Next 15 with Turbopack and the "new" Tanstack React Query integration.3 replies
What is the substitution for queryKey in useQuery?
In vanilla @tanstack/react-query, queryKey works as dependencies referrence so the query refetches automatically as it changes. Just like useEffect's dependency array.
It's not present in tRPC flavoured useQuery, looks like it is handled automatically.
So what to do instead? How to attach such dependencies to query?
3 replies