The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 06:45 UTC
perf(web): the agent connect surface compiles without manual memoization (#20639)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:58 UTC
6a0587c9599f808840d8f63eb09d9481007c22cc
1 file changed
+22
-25
apps/web/src/components/auth/ConnectAgentSurface.tsx
+22
-25
@@ -11,7 +11,7 @@ import { EyeIcon, type LucideIcon } from "lucide-react";
11
import type * as Context from "effect/Context";
12
import * as Effect from "effect/Effect";
13
import * as Schema from "effect/Schema";
14
-import { type ReactNode, useCallback, useEffect, useState } from "react";
14
+import { type ReactNode, useEffect, useState } from "react";
15
16
import { PrimaryEnvironmentHttpClient } from "~/environments/primary/httpClient";
17
import { runPrimaryHttp } from "~/lib/runtime";
@@ -116,30 +116,27 @@ export function ConnectAgentSurface() {
116
};
117
}, [authorization]);
118
119
- const decide = useCallback(
120
- async (choice: "approve" | "deny") => {
121
- if (loaded.status !== "ready") return;
122
- setPending(choice);
123
- setErrorMessage("");
124
- const { csrfToken } = loaded.details;
125
- const decision: AuthMcpApprovalDecision =
126
- choice === "deny"
127
- ? { _tag: "deny" }
128
- : csrfToken !== undefined && oneClickApproves(loaded.details, access)
129
- ? { _tag: "browser-session", access, csrfToken }
130
- : { _tag: "pairing-code", access, code: pairingCode.trim() };
131
- const answer = await runApproval((client) =>
132
- client.mcpOAuth.decision({ payload: { authorization, decision } }),
133
- );
134
- if (answer.kind === "redirect") {
135
- window.location.replace(answer.url);
136
- return;
137
- }
138
- setPending(null);
139
- setErrorMessage(answer.kind === "error" ? answer.message : "The sign-in could not continue.");
140
- },
141
- [access, authorization, loaded, pairingCode],
142
- );
119
+ const decide = async (choice: "approve" | "deny") => {
120
+ if (loaded.status !== "ready") return;
121
+ setPending(choice);
122
+ setErrorMessage("");
123
+ const { csrfToken } = loaded.details;
124
+ const decision: AuthMcpApprovalDecision =
125
+ choice === "deny"
126
+ ? { _tag: "deny" }
127
+ : csrfToken !== undefined && oneClickApproves(loaded.details, access)
128
+ ? { _tag: "browser-session", access, csrfToken }
129
+ : { _tag: "pairing-code", access, code: pairingCode.trim() };
130
+ const answer = await runApproval((client) =>
131
+ client.mcpOAuth.decision({ payload: { authorization, decision } }),
132
+ );
133
+ if (answer.kind === "redirect") {
134
+ window.location.replace(answer.url);
135
+ return;
136
+ }
137
+ setPending(null);
138
+ setErrorMessage(answer.kind === "error" ? answer.message : "The sign-in could not continue.");
139
+ };
140
141
if (loaded.status === "loading") {
142
return (