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
commit 5303ab09f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 20 deletions

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)