fix(app): route new sessions through tabs (#33582)
This commit is contained in:
parent
51eb87b256
commit
5303ab09f8
3 changed files with 37 additions and 20 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue