shovancak
shovancak16mo ago

createTRPCNext and createTRPCProxyClient within one NextJs app

Hey, Is there any possibility to use createTRPCNext and createTRPCProxyClient clients in one NextJs app? I have a use-case where I need to use a vanilla client to fetch data in my app but I don't want to lose the possibility of using useQuery and useMutation hooks in my components.
6 Replies
Nick
Nick16mo ago
You can use both, it might be a code smell if there’s a better way but they shouldn’t conflict with each other
shovancak
shovancak16mo ago
But what about things like caching or query invalidation? Client created by createTRPCProxyClient use tenstack react query it is handled out of the box 🤔. This can be problem in case of vanilla client
Nick
Nick16mo ago
Yep, that’s your trade off
shovancak
shovancak16mo ago
Thank you 👍
mossotron
mossotron15mo ago
Im also running into this issue today, would be cool if there was a way you could pass the client created from createTRPCProxyClient into createTRPCNext so you're sharing the instance between them. Or better, a way to access the underlying trpc client created by createTRPCNext
Alex / KATT 🐱
Alex / KATT 🐱15mo ago
GitHub
Allowing prefetch outside of component but still client-side? · trp...
I was trying out the new tanstack router and trying to integrate it with tRPC. This works fine, but I also want to use the loader function of tanstack router to prefetch the data to prevent some wa...
More Posts
Calling axios requests not workingIf i call an API using axios in trpc query procedure It works if the url is https it dont if url is Best practices in naming and defining procedures when they don't fit into standard buckets?I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. Separating routers into their own modules and merging them causes "any" type in clientHi all, I've separated my router into multiple files, but when merging them I get `any` types for acustom query functionI have a use case where I need a trpc procedure call when a specific key is not present in the localTRPC type checking during build failsEnvironment: node 18.6.0, yarn Whats wrong: Type checking at build time fails. . I think this mightcreateTRPCNext config ctx always returns undefined.Hi Everyone. So I'm trying to use TRPC and Nextjs for auth and post query etc. I have client side cStandalone Next.js 13.3.2 errorHi, since the 13.3.2 update of Next.js, I have the following error : ``` TypeError: Cannot read proDoes tRPC works in application network layer (HTTP) or transport network layer (TCP, UDP)?Just wondering if tRPC uses TCP under the hood.returning undefined from server gets stripped on the clientI encounter this issue when working with TRPC React under a Turborepo. But I works fine on Next I sTypeScript, Mono-Repositories and Internal Packages / Project ReferencesI am getting quite frustrate with project references / internal projects and the resolving of types