.jsonp.
tRPC9mo ago
1 reply
.jsonp

Exposing server-side caller and tRPC caller/helper through the same export?

Hey there 👋 I'm wondering if anyone thinks it could be unwise to expose the server-side caller and the tRPC caller through the same export.

// server.ts
import "server-only";
// ...
const caller = createCaller(createContext);

export const getQueryClient = cache(createQueryClient);

const helpers = createTRPCOptionsProxy({
  ctx: createContext,
  router: appRouter,
  queryClient: getQueryClient,
});

export const api = {
  caller,
  helpers,
};


I would prefer to use both through a single export, but I'm unsure if could be bad practice. Any thoughts are appreciated.
Was this page helpful?