authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-12 22:39:16-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-12 22:44:14-08:00
log521238cf8e1daf041e7541bb1acef8c347431079
tree2b04e7bf114ea00870c3f8320a5b19df5a69cfd4
parent5da67c40ebab884911f3fb1d51121d42b0fd1fba

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 files changed, 2 insertions(+), 14 deletions(-)

apps/web/src/components/ChatView.tsx+2-14
...@@ -262,24 +262,12 @@ export default function ChatView() {...@@ -262,24 +262,12 @@ export default function ChatView() {
262 }, []);262 }, []);
263 const toggleTerminalVisibility = useCallback(() => {263 const toggleTerminalVisibility = useCallback(() => {
264 if (!activeThreadId) return;264 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
277 dispatch({265 dispatch({
278 type: "SET_THREAD_TERMINAL_OPEN",266 type: "SET_THREAD_TERMINAL_OPEN",
279 threadId: activeThreadId,267 threadId: activeThreadId,
280 open: !isOpen,268 open: !activeThread?.terminalOpen,
281 });269 });
282 }, [activeThread?.terminalOpen, activeThreadId, api, dispatch]);270 }, [activeThread?.terminalOpen, activeThreadId, dispatch]);
283 const splitTerminal = useCallback(() => {271 const splitTerminal = useCallback(() => {
284 if (!activeThreadId) return;272 if (!activeThreadId) return;
285 dispatch({273 dispatch({