Simplify terminal toggle to only update visibility state

- Remove terminal close/exit API calls from `toggleTerminalVisibility`
- Keep toggle behavior as a pure UI state change for active thread
This commit is contained in:
Julius Marminge committed 2026-02-12 22:39:16 -08:00
1 parent 5da67c40eb
commit e817a0e702
1 file changed
+2 -14
+2 -14
View File
@@ -262,24 +262,12 @@ export default function ChatView() {
}, []);
const toggleTerminalVisibility = useCallback(() => {
if (!activeThreadId) return;
const isOpen = Boolean(activeThread?.terminalOpen);
if (isOpen && api) {
if (typeof api.terminal.close === "function") {
void api.terminal.close({ threadId: activeThreadId }).catch(() => {
void api.terminal.write({ threadId: activeThreadId, data: "exit\n" }).catch(() => undefined);
});
} else {
void api.terminal.write({ threadId: activeThreadId, data: "exit\n" }).catch(() => undefined);
}
}
dispatch({
type: "SET_THREAD_TERMINAL_OPEN",
threadId: activeThreadId,
open: !isOpen,
open: !activeThread?.terminalOpen,
});
}, [activeThread?.terminalOpen, activeThreadId, api, dispatch]);
}, [activeThread?.terminalOpen, activeThreadId, dispatch]);
const splitTerminal = useCallback(() => {
if (!activeThreadId) return;
dispatch({