tenzerino
how can I set up trpc to work with nested providers?
Seems to be similar to https://github.com/trpc/trpc/discussions/6685.
In theory this should be possible, as this has been implemented by this pr, although I'm not sure if your setup is correct.
There is a test for multiple trpc providers for @trpc/react-query, where you could look at the setup and if it is implementable in your app.
4 replies
Server actions leaking .env
Server actions are mostly for mutating data, not for fetching it. When u want to fetch data you can just query directly from your client components or use a server-caller for calling procedures on the server.
At the same time, none of the code you showed uses your drizzle database or schema, so I would guess that your custom server context, where you add the db to the context for procedures etc., somehow runs on the client somewhere.
If you are using TanStack React Query, please make sure that the
createTRPCContext
method from which you extract useTRPC
etc. comes from the @trpc/tanstack-react-query
package and isn't one you defined in a server environment. If this is not the case, we would likely need more information to identify the problem.3 replies
Hydration error when using useQuery instead of useSuspenseQuery when prefetching
this is also happening to me, could also fix this by
await
ing the prefetch call instead of void
ing it like the docs say but that would disable some streaming stuff. really struggling if this is a trpc / tanstack-react-query bug or if im doing something wrong11 replies