From fd4497e6b92e4f9bf4809d537d6d122adfbbf896 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 6 Jul 2026 19:39:22 -0400 Subject: [PATCH] fix(tui): route shell termination by location --- packages/tui/src/context/data.tsx | 9 --------- packages/tui/src/routes/session/composer/shell-tab.tsx | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/tui/src/context/data.tsx b/packages/tui/src/context/data.tsx index 87973249ee8..581ebe17560 100644 --- a/packages/tui/src/context/data.tsx +++ b/packages/tui/src/context/data.tsx @@ -831,15 +831,6 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({ shell: Object.fromEntries(mutable(result.data).map((info) => [info.id, info])), }) }, - async remove(id: string) { - await sdk.api.shell.remove({ id }) - setStore( - "location", - produce((draft) => { - for (const data of Object.values(draft)) delete data.shell?.[id] - }), - ) - }, }, location: { default() { diff --git a/packages/tui/src/routes/session/composer/shell-tab.tsx b/packages/tui/src/routes/session/composer/shell-tab.tsx index 1ea9f73fd3c..90e90a17855 100644 --- a/packages/tui/src/routes/session/composer/shell-tab.tsx +++ b/packages/tui/src/routes/session/composer/shell-tab.tsx @@ -2,12 +2,16 @@ import { createMemo, For, Show, createEffect, onMount, onCleanup } from "solid-j import { createStore } from "solid-js/store" import { TextAttributes, RGBA, ScrollBoxRenderable } from "@opentui/core" import { useData } from "../../../context/data" +import { useLocation } from "../../../context/location" +import { useSDK } from "../../../context/sdk" import { useTheme, selectedForeground } from "../../../context/theme" import { useBindings, useCommandShortcut } from "../../../keymap" import { useComposerTab } from "./index" export function ShellTab(props: { sessionID: string }) { const data = useData() + const location = useLocation() + const sdk = useSDK() const { theme } = useTheme() const fg = selectedForeground(theme) const composer = useComposerTab() @@ -79,7 +83,11 @@ export function ShellTab(props: { sessionID: string }) { run() { const entry = selectedEntry() if (!entry) return - void data.shell.remove(entry.id) + const ref = location() + void sdk.api.shell.remove({ + id: entry.id, + location: ref ? { directory: ref.directory, workspace: ref.workspaceID } : undefined, + }) }, }, ],