authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-09-25 20:29:28-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-25 20:29:28-07:00
log6989856aa630611dd7d6dcc8cfe9f97456816284
treed600736ebd2e5ce388bf2e4e208288adc5fd18bd
parentb2577d6eface9589d120bdc53e4ec0431b1e9331
signature Signed by PGP key B5690EEEBB952194

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>

1 files changed, 8 insertions(+), 1 deletions(-)

apps/web/src/components/ChatView.tsx+8-1
......@@ -917,7 +917,14 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra
917917 const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write");
918918 const closeTerminalMutation = useAtomCommand(terminalEnvironment.close, "terminal close");
919919 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;
921928 const projectRef = serverThread
922929 ? scopeProjectRef(serverThread.environmentId, serverThread.projectId)
923930 : draftThread