MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / config

Function config

app/src/utils/api.ts:21–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19/** A set of type-safe react-query hooks for your tRPC API. */
20export const api = createTRPCNext<AppRouter>({
21 config() {
22 return {
23 /**
24 * Transformer used for data de-serialization from the server.
25 *
26 * @see https://trpc.io/docs/data-transformers
27 */
28 transformer: superjson,
29
30 /**
31 * Links used to determine request flow from client to server.
32 *
33 * @see https://trpc.io/docs/links
34 */
35 links: [
36 loggerLink({
37 enabled: (opts) =>
38 (process.env.NODE_ENV ?? "development") === "development" ||
39 (opts.direction === "down" && opts.result instanceof Error),
40 }),
41 splitLink({
42 condition(op) {
43 return op.context.slowBatch === true;
44 },
45 // separate batching for slow requests
46 true: httpBatchLink({
47 url: `${getBaseUrl()}/api/trpc`,
48 }),
49 false: httpBatchLink({
50 url: `${getBaseUrl()}/api/trpc`,
51 }),
52 }),
53 ],
54 };
55 },
56 /**
57 * Whether tRPC should await queries when server rendering pages.
58 *

Callers

nothing calls this directly

Calls 1

getBaseUrlFunction · 0.85

Tested by

no test coverage detected