Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

perf(ui): disable trpc batching (#2999)

Marc Klingen4a89cf4e453c
diff --git a/web/src/pages/api/trpc/[trpc].ts b/web/src/pages/api/trpc/[trpc].ts
index 5500250482..b53666e885 100644
--- a/web/src/pages/api/trpc/[trpc].ts
+++ b/web/src/pages/api/trpc/[trpc].ts
@@ -1,5 +1,4 @@
import { createNextApiHandler } from "@trpc/server/adapters/next";
-
import { createTRPCContext } from "@/src/server/api/trpc";
import { appRouter } from "@/src/server/api/root";
@@ -11,9 +10,6 @@ export const config = {
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
- // batching: {
- // enabled: false,
- // },
onError: ({ path, error }) => {
console.error(`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`);
},
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index b0743acca3..1baf389116 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -52,7 +52,12 @@ export const api = createTRPCNext<AppRouter>({
splitLink({
condition(op) {
// check for context property `skipBatch`
- return op.context.skipBatch === true;
+ const skipBatch = op.context.skipBatch === true;
+
+ // Manually skip batching, perf experiment
+ const alwaysSkipBatch = true;
+
+ return skipBatch || alwaysSkipBatch;
},
// when condition is true, use normal request
true: httpLink({