Skip to content
TypeScript

perf(web): the agent connect surface compiles without manual memoization (#20639)

Julius Marminge6a0587c9599f
diff --git a/apps/web/src/components/auth/ConnectAgentSurface.tsx b/apps/web/src/components/auth/ConnectAgentSurface.tsx
index c9d99a901d9..f56a65e98e6 100644
--- a/apps/web/src/components/auth/ConnectAgentSurface.tsx
+++ b/apps/web/src/components/auth/ConnectAgentSurface.tsx
@@ -11,7 +11,7 @@ import { EyeIcon, type LucideIcon } from "lucide-react";
import type * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
-import { type ReactNode, useCallback, useEffect, useState } from "react";
+import { type ReactNode, useEffect, useState } from "react";
import { PrimaryEnvironmentHttpClient } from "~/environments/primary/httpClient";
import { runPrimaryHttp } from "~/lib/runtime";
@@ -116,30 +116,27 @@ export function ConnectAgentSurface() {
};
}, [authorization]);
- const decide = useCallback(
- async (choice: "approve" | "deny") => {
- if (loaded.status !== "ready") return;
- setPending(choice);
- setErrorMessage("");
- const { csrfToken } = loaded.details;
- const decision: AuthMcpApprovalDecision =
- choice === "deny"
- ? { _tag: "deny" }
- : csrfToken !== undefined && oneClickApproves(loaded.details, access)
- ? { _tag: "browser-session", access, csrfToken }
- : { _tag: "pairing-code", access, code: pairingCode.trim() };
- const answer = await runApproval((client) =>
- client.mcpOAuth.decision({ payload: { authorization, decision } }),
- );
- if (answer.kind === "redirect") {
- window.location.replace(answer.url);
- return;
- }
- setPending(null);
- setErrorMessage(answer.kind === "error" ? answer.message : "The sign-in could not continue.");
- },
- [access, authorization, loaded, pairingCode],
- );
+ const decide = async (choice: "approve" | "deny") => {
+ if (loaded.status !== "ready") return;
+ setPending(choice);
+ setErrorMessage("");
+ const { csrfToken } = loaded.details;
+ const decision: AuthMcpApprovalDecision =
+ choice === "deny"
+ ? { _tag: "deny" }
+ : csrfToken !== undefined && oneClickApproves(loaded.details, access)
+ ? { _tag: "browser-session", access, csrfToken }
+ : { _tag: "pairing-code", access, code: pairingCode.trim() };
+ const answer = await runApproval((client) =>
+ client.mcpOAuth.decision({ payload: { authorization, decision } }),
+ );
+ if (answer.kind === "redirect") {
+ window.location.replace(answer.url);
+ return;
+ }
+ setPending(null);
+ setErrorMessage(answer.kind === "error" ? answer.message : "The sign-in could not continue.");
+ };
if (loaded.status === "loading") {
return (