perf(web): hidden terminal drawers no longer keep full thread history in memory (#13686)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
b2577d6efa
commit
6989856aa6
1 file changed
+8
-1
@@ -917,7 +917,14 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra
|
||||
const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write");
|
||||
const closeTerminalMutation = useAtomCommand(terminalEnvironment.close, "terminal close");
|
||||
const draftThread = useComposerDraftStore((store) => store.getDraftThreadByRef(threadRef));
|
||||
const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
|
||||
// Hidden drawers stay mounted (see MAX_HIDDEN_MOUNTED_TERMINAL_THREADS), so they read only
|
||||
// the shell: a detail subscription would keep each hidden thread's history in memory. The
|
||||
// active drawer shares ChatView's detail, which also covers archived threads (no shell).
|
||||
const activeServerThread = useThread(active ? threadRef : null, {
|
||||
waitForShell: draftThread !== null,
|
||||
});
|
||||
const serverThreadShell = useThreadShell(threadRef);
|
||||
const serverThread = activeServerThread ?? serverThreadShell;
|
||||
const projectRef = serverThread
|
||||
? scopeProjectRef(serverThread.environmentId, serverThread.projectId)
|
||||
: draftThread
|
||||
|
||||
Reference in new issue
Block a user