From b866900417f244a7ca398bfd82ff27a1c883f79a Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 30 Jul 2026 19:59:27 -0400 Subject: [PATCH] fix(tui): name deleted session in toast (#39768) --- packages/tui/src/app.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/tui/src/app.tsx b/packages/tui/src/app.tsx index f0bc50cc81b..5ccdd817b60 100644 --- a/packages/tui/src/app.tsx +++ b/packages/tui/src/app.tsx @@ -525,8 +525,11 @@ function App(props: { pair?: DialogPairCredentials }) { renderer.useMouse = config.data.mouse }) + let active: { id: string; title: string } | undefined // Update terminal window title based on current route and session createEffect(() => { + const session = route.data.type === "session" ? data.session.get(route.data.sessionID) : undefined + if (session) active = { id: session.id, title: session.title } if (!terminalTitleEnabled()) return if (route.data.type === "home") { @@ -535,7 +538,6 @@ function App(props: { pair?: DialogPairCredentials }) { } if (route.data.type === "session") { - const session = data.session.get(route.data.sessionID) if (!session || isDefaultTitle(session.title)) { renderer.setTerminalTitle("OpenCode") return @@ -1160,10 +1162,11 @@ function App(props: { pair?: DialogPairCredentials }) { event.on("session.deleted", (evt) => { if (route.data.type === "session" && route.data.sessionID === evt.data.sessionID) { + const title = active?.id === evt.data.sessionID ? active.title : undefined route.navigate({ type: "home" }) toast.show({ variant: "info", - message: "The current session was deleted", + message: title ? `Session "${title}" was deleted` : "The current session was deleted", }) } })