ian
ian
TtRPC
Created by ian on 3/18/2024 in #❓-help
Complex type inference on router outputs?
What are the best practices on complex outputs from routers and typing on the FE? We are doing quite a bit of munging of data from multiple sources, so there's no real concept of an upstream "primitive" as there would be in a simple trpc + nextjs + prisma setup. How is everyone doing typing in a scenario like this? It feels brittle to bind a UI element to the response from a router as that will intrinsically bind those two elements together, making the component non-reusable. Is there a typing layer for trpc that sorta behaves like GQL, where you get a meta layer of types from the router responses?
3 replies
TtRPC
Created by ian on 12/8/2023 in #❓-help
How to pass through authentication header when using createTRPCProxyClient and RSC?
Hi - we are having a great time with tRPC, and have it working well in a Next14 + React Server Components environment. However, we're seeing that the headers aren't being passed through when a trpc query call is made from within a RSC component via await trcp.profile.me.query() I looked into trying to pass through the headers and there's no way to access the actual headers from the current request, only to add new ones via headers() function. What is the preferred way to pass through auth headers in a client => RSC => trpc.query => server environment?
9 replies