Compare commits

...

1 Commits

Author SHA1 Message Date
Brendan Allan 43ff2ee9cc fix(app): close missing child session tabs 2026-07-30 13:02:52 +00:00
3 changed files with 14 additions and 2 deletions
@@ -39,7 +39,9 @@ test("shows the not found fallback when the viewed session is deleted", async ({
})
await expect(page.getByText("This session cannot be found")).toBeVisible()
await expect(page.getByRole("button", { name: "Close Tab" })).toBeVisible()
await page.getByRole("button", { name: "Close Tab" }).click()
await expect(page).toHaveURL(/\/$/)
await expect(page.getByText("This session cannot be found")).toHaveCount(0)
await expect(page.getByRole("heading", { name: taskDescription })).toHaveCount(0)
})
+10
View File
@@ -249,6 +249,16 @@ export const { use: useTabs, provider: TabsProvider } = createSimpleContext({
removeDraftPersisted(draftID)
},
removeTab,
// Child routes share their root session's tab, so the route ID cannot
// identify the tab once a deleted child falls back to an error page.
removeActiveTab(key: ServerConnection.Key) {
const index = store.findIndex((tab) => tab.server === key && tabKey(tab) === recentKey())
if (index === -1) {
navigate("/")
return
}
removeTab(index)
},
// User-initiated close: records the tab so it can be reopened.
// Cleanup paths (missing sessions, archive, server removal) go through
// removeTab and friends directly and are not recorded.
+1 -1
View File
@@ -211,7 +211,7 @@ function SessionErrorFallback(props: { error: unknown; sessionID?: string; serve
})
const closeTab = () => {
if (!props.sessionID) return
tabs.removeSessionTab({ server: props.serverKey ?? server.key, sessionId: props.sessionID })
tabs.removeActiveTab(props.serverKey ?? server.key)
}
if (isCurrentSessionNotFoundError(props.error, props.sessionID)) {
return (