Skip to content

Commit e817a0e

Browse files
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
1 parent 5da67c4 commit e817a0e

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,24 +262,12 @@ export default function ChatView() {
262262
}, []);
263263
const toggleTerminalVisibility = useCallback(() => {
264264
if (!activeThreadId) return;
265-
const isOpen = Boolean(activeThread?.terminalOpen);
266-
267-
if (isOpen && api) {
268-
if (typeof api.terminal.close === "function") {
269-
void api.terminal.close({ threadId: activeThreadId }).catch(() => {
270-
void api.terminal.write({ threadId: activeThreadId, data: "exit\n" }).catch(() => undefined);
271-
});
272-
} else {
273-
void api.terminal.write({ threadId: activeThreadId, data: "exit\n" }).catch(() => undefined);
274-
}
275-
}
276-
277265
dispatch({
278266
type: "SET_THREAD_TERMINAL_OPEN",
279267
threadId: activeThreadId,
280-
open: !isOpen,
268+
open: !activeThread?.terminalOpen,
281269
});
282-
}, [activeThread?.terminalOpen, activeThreadId, api, dispatch]);
270+
}, [activeThread?.terminalOpen, activeThreadId, dispatch]);
283271
const splitTerminal = useCallback(() => {
284272
if (!activeThreadId) return;
285273
dispatch({

0 commit comments

Comments
 (0)