@devries-cameron20 / t3code-1 / commits / 37ea8a88de
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(web): the MCP app frame keeps its caching without "use memo" hooks (#20759)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 23:20 UTC 37ea8a88dee3fe3256e6333e10dd43c214ec660c
1 file changed +10 -13
apps/web/src/components/chat/McpAppFrame.tsx
+10 -13
@@ -60,18 +60,6 @@ function saveBlob(blob: Blob, name: string) {
60 setTimeout(() => URL.revokeObjectURL(url), 60_000);
61 }
62
63 -// The host gets the tool call pushed by an effect keyed on it, so it stays
64 -// stable across the command hooks that follow.
65 -function useToolCall(
66 - storedItem: NonNullable<ReturnType<typeof useTurnItemDetail>["data"]>["item"] | undefined,
67 -) {
68 - "use memo";
69 - if (storedItem?.type !== "dynamic_tool") return undefined;
70 - const output = storedItem.output as { readonly result?: unknown } | undefined;
71 - const result = output?.result as McpAppCallToolResult | undefined;
72 - return { arguments: storedItem.input, result };
73 -}
74 -
63 export function McpAppFrame(props: {
64 readonly environmentId: EnvironmentId;
65 readonly threadId: ThreadId;
@@ -142,7 +130,16 @@ export function McpAppFrame(props: {
130 revision: props.revision,
131 });
132 const storedItem = detail.data?.item;
145 - const toolCall = useToolCall(storedItem);
133 + // The host gets the tool call pushed by an effect keyed on it, so it must stay cached.
134 + const toolCall =
135 + storedItem?.type === "dynamic_tool"
136 + ? {
137 + arguments: storedItem.input,
138 + result: (storedItem.output as { readonly result?: unknown } | undefined)?.result as
139 + | McpAppCallToolResult
140 + | undefined,
141 + }
142 + : undefined;
143
144 const callTool = useAtomCommand(mcpAppEnvironment.callTool, { reportFailure: false });
145 const toolInfo = useAtomCommand(mcpAppEnvironment.toolInfo, { reportFailure: false });