diff --git a/apps/web/src/store.test.ts b/apps/web/src/store.test.ts index e2e083e3be91c8ac2720c427fc8451c45a9438bf..176a6a73fc0d93a11d81b8586c58abe5750291b0 100644 --- a/apps/web/src/store.test.ts +++ b/apps/web/src/store.test.ts @@ -287,7 +287,7 @@ describe("store reducer thread continuity", () => { ]); }); - it("closes the final terminal and keeps the drawer visibility unchanged", () => { + it("closes the final terminal and hides the drawer", () => { const state = makeState( makeThread({ terminalOpen: true, @@ -300,7 +300,7 @@ describe("store reducer thread continuity", () => { terminalId: DEFAULT_THREAD_TERMINAL_ID, }); - expect(next.threads[0]?.terminalOpen).toBe(true); + expect(next.threads[0]?.terminalOpen).toBe(false); expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]); expect(next.threads[0]?.runningTerminalIds).toEqual([]); expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID); diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts index 44d2ff02d03d530626b19b5215d2d82688fde41f..3f944601b1cb61f923e671cfca63f1d3be033f09 100644 --- a/apps/web/src/store.ts +++ b/apps/web/src/store.ts @@ -269,17 +269,17 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread { const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId); if (remainingTerminalIds.length === 0) { - const nextTerminalId = terminalId; - const nextTerminalGroupId = fallbackGroupId(nextTerminalId); + const nextTerminalGroupId = fallbackGroupId(DEFAULT_THREAD_TERMINAL_ID); return normalizeThreadTerminals({ ...thread, - terminalIds: [nextTerminalId], + terminalOpen: false, + terminalIds: [DEFAULT_THREAD_TERMINAL_ID], runningTerminalIds: [], - activeTerminalId: nextTerminalId, + activeTerminalId: DEFAULT_THREAD_TERMINAL_ID, terminalGroups: [ { id: nextTerminalGroupId, - terminalIds: [nextTerminalId], + terminalIds: [DEFAULT_THREAD_TERMINAL_ID], }, ], activeTerminalGroupId: nextTerminalGroupId,