Closed ghost closed 1 year ago
You can use trpc().createContext().client
to grab the original client.
Although, you would not be able to initialize a client in a +server.ts
or +page.server.ts
, since QueryClient
is not available on the server. In this case, you might want to import your trpc router
directly and call router.createCaller()
to create a tRPC caller on the server.
@pukarsharma112, is the issue resolved? If so, can you please close it?
Closing due to inactivity.
i was able to use createContext() on +page.server.ts and +server.ts by passing queryClient as empty object ( although typescript shows error ) but i got my problem solved atleast so this issue can be closed :-)
how to get the original trpc client to get data on the server load/actions or inside +server.ts files?