Hobbs
Explore posts from serversCorrect tRPC implementation (NextJS AppDir)
Another thing to note is that if you are using server actions that those can't run in parallel (you might want to double check to confirm) but I recall that being the case. So basically I try to stick to using server actions only for mutations
55 replies
Correct tRPC implementation (NextJS AppDir)
For the loading times it sounds like it has to do with your refetchInterval/staleTime
If you are using the hydration pattern you can preFetch/PreHydrate your data as well and that can make it appear quicker
55 replies
Correct tRPC implementation (NextJS AppDir)
So i'm basically importing my
trpc
from /utils/trpc.ts then using that to make my requests however I have no clue how you would differentiate this from a server vs client (i'm using the createTRPCNext
method , does this handle if it's client vs server on it's own or did you by any chance go down the rabbit hole of setting up a createCallerFactory
? haha55 replies
Correct tRPC implementation (NextJS AppDir)
What's confusing to me is in the pages router you'd have a
withTRPC
that wraps the app router / App itself
In app directory from what I understand is we create that kind of psuedo provider and combine it with a query provider to wrap the application and both of those use local state for the queryClient/trpcClient55 replies
Correct tRPC implementation (NextJS AppDir)
Awesome, thank you for sharing!
I can probably help with the loading times if you want to minimize or simulate it being instantaneous.
Curious - do you have to do a trpc server / client implementation? Meaning a separate procedure/instance if you want to use trpc to make requests on the server side vs client?
55 replies