fix(app): route new sessions through tabs (#33582)

This commit is contained in:
Brendan Allan
2026-06-24 11:48:33 +08:00
committed by GitHub
parent dd350884ea
commit 9d2cd9c428
3 changed files with 37 additions and 20 deletions
+3 -1
View File
@@ -115,13 +115,15 @@ export const { use: useTabs, provider: TabsProvider } = createSimpleContext({
const actions = {
addSessionTab: (tab: Omit<SessionTab, "type">) => {
const next = { type: "session" as const, ...tab }
if (closing.has(tabKey(next))) return
const existing = store.find((item) => tabKey(item) === tabKey(next))
if (existing) return existing
setStore(
produce((tabs) => {
if (tabs.some((item) => tabKey(item) === tabKey(next))) return
tabs.push(next)
}),
)
return next
},
draft(draftID: string) {
const tab = store.find((item) => item.type === "draft" && item.draftID === draftID)