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, 05:30 UTC
refactor(web): the command output panel keeps its caching without "use memo" hooks (#20763)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 23:23 UTC
3b618903d63687c0e7fa402b90e6ba920faec40b
1 file changed
+2
-8
apps/web/src/components/chat/CommandOutputPanel.tsx
+2
-8
@@ -22,13 +22,6 @@ export function useCommandOutputStreaming(environmentId: EnvironmentId): boolean
22
* shows its final output. Mount it only when `useCommandOutputStreaming` holds.
23
* It subscribes only while mounted, so collapsed rows and other threads receive nothing.
24
*/
25
-// Parsing ANSI output is linear in its length, and the compiler would redo it on
26
-// every render because the layout effect runs after it.
27
-function useTerminalOutputSpans(text: string, resolvedTheme: keyof typeof TERMINAL_PALETTES) {
28
- "use memo";
29
- return terminalOutputSpans(text, TERMINAL_PALETTES[resolvedTheme]);
30
-}
31
-
25
export function CommandOutputPanel(props: {
26
readonly environmentId: EnvironmentId;
27
readonly threadId: ThreadId;
@@ -45,7 +38,6 @@ export function CommandOutputPanel(props: {
38
const followRef = useRef(true);
39
const text = data?.output.text ?? "";
40
const { resolvedTheme } = useTheme();
48
- const spans = useTerminalOutputSpans(text, resolvedTheme);
41
42
// This panel only re-renders when its output changes, so keep the end in view after each.
43
useLayoutEffect(() => {
@@ -58,6 +50,8 @@ export function CommandOutputPanel(props: {
50
if (data === null) return <div className="text-muted-foreground italic">Loading output…</div>;
51
return data.running ? null : <div className="text-muted-foreground italic">No output.</div>;
52
}
53
+ // Parsed after the layout effect, the last hook, so the compiler caches it on text and theme.
54
+ const spans = terminalOutputSpans(text, TERMINAL_PALETTES[resolvedTheme]);
55
return (
56
<div>
57
{data?.output.truncated ? (