@devries-cameron20 / t3code Mirror · read-only / commits / 6989856aa6
Fork 0

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, 21:45 UTC

perf(web): hidden terminal drawers no longer keep full thread history in memory (#13686)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Theo Browne committed Sep 25, 2026 at 20:29 UTC 6989856aa630611dd7d6dcc8cfe9f97456816284
1 file changed +8 -1
apps/web/src/components/ChatView.tsx
+8 -1
@@ -917,7 +917,14 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra
917 const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write");
918 const closeTerminalMutation = useAtomCommand(terminalEnvironment.close, "terminal close");
919 const draftThread = useComposerDraftStore((store) => store.getDraftThreadByRef(threadRef));
920 - const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
920 + // Hidden drawers stay mounted (see MAX_HIDDEN_MOUNTED_TERMINAL_THREADS), so they read only
921 + // the shell: a detail subscription would keep each hidden thread's history in memory. The
922 + // active drawer shares ChatView's detail, which also covers archived threads (no shell).
923 + const activeServerThread = useThread(active ? threadRef : null, {
924 + waitForShell: draftThread !== null,
925 + });
926 + const serverThreadShell = useThreadShell(threadRef);
927 + const serverThread = activeServerThread ?? serverThreadShell;
928 const projectRef = serverThread
929 ? scopeProjectRef(serverThread.environmentId, serverThread.projectId)
930 : draftThread