authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-15 00:14:02-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-15 00:14:02-08:00
log6e46a7be3899db0c03b9b6e304d973b3efa54c3d
tree1e93a7f6fa19f45eb6d3e1f0e50546e95a374b84
parent0be98ea9d1dfbfda750e71d783df1cb2524ec92d

Hide drawer on final terminal close

Co-authored-by: codex <codex@users.noreply.github.com>

2 files changed, 7 insertions(+), 7 deletions(-)

apps/web/src/store.test.ts+2-2
...@@ -287,7 +287,7 @@ describe("store reducer thread continuity", () => {...@@ -287,7 +287,7 @@ describe("store reducer thread continuity", () => {
287 ]);287 ]);
288 });288 });
289289
290 it("closes the final terminal and keeps the drawer visibility unchanged", () => {290 it("closes the final terminal and hides the drawer", () => {
291 const state = makeState(291 const state = makeState(
292 makeThread({292 makeThread({
293 terminalOpen: true,293 terminalOpen: true,
...@@ -300,7 +300,7 @@ describe("store reducer thread continuity", () => {...@@ -300,7 +300,7 @@ describe("store reducer thread continuity", () => {
300 terminalId: DEFAULT_THREAD_TERMINAL_ID,300 terminalId: DEFAULT_THREAD_TERMINAL_ID,
301 });301 });
302302
303 expect(next.threads[0]?.terminalOpen).toBe(true);303 expect(next.threads[0]?.terminalOpen).toBe(false);
304 expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]);304 expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]);
305 expect(next.threads[0]?.runningTerminalIds).toEqual([]);305 expect(next.threads[0]?.runningTerminalIds).toEqual([]);
306 expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID);306 expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID);
apps/web/src/store.ts+5-5
...@@ -269,17 +269,17 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread {...@@ -269,17 +269,17 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread {
269269
270 const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId);270 const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId);
271 if (remainingTerminalIds.length === 0) {271 if (remainingTerminalIds.length === 0) {
272 const nextTerminalId = terminalId;272 const nextTerminalGroupId = fallbackGroupId(DEFAULT_THREAD_TERMINAL_ID);
273 const nextTerminalGroupId = fallbackGroupId(nextTerminalId);
274 return normalizeThreadTerminals({273 return normalizeThreadTerminals({
275 ...thread,274 ...thread,
276 terminalIds: [nextTerminalId],275 terminalOpen: false,
276 terminalIds: [DEFAULT_THREAD_TERMINAL_ID],
277 runningTerminalIds: [],277 runningTerminalIds: [],
278 activeTerminalId: nextTerminalId,278 activeTerminalId: DEFAULT_THREAD_TERMINAL_ID,
279 terminalGroups: [279 terminalGroups: [
280 {280 {
281 id: nextTerminalGroupId,281 id: nextTerminalGroupId,
282 terminalIds: [nextTerminalId],282 terminalIds: [DEFAULT_THREAD_TERMINAL_ID],
283 },283 },
284 ],284 ],
285 activeTerminalGroupId: nextTerminalGroupId,285 activeTerminalGroupId: nextTerminalGroupId,