| ... | ... | @@ -917,7 +917,14 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra |
| 917 | 917 | const writeTerminal = useAtomCommand(terminalEnvironment.write, "terminal write"); |
| 918 | 918 | const closeTerminalMutation = useAtomCommand(terminalEnvironment.close, "terminal close"); |
| 919 | 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; |
| 921 | 928 | const projectRef = serverThread |
| 922 | 929 | ? scopeProjectRef(serverThread.environmentId, serverThread.projectId) |
| 923 | 930 | : draftThread |