Skip to content

Commit 423a899

Browse files
ProdigyRahulishaksebsib
authored andcommitted
fix(app): session tabs to open the previous opened (anomalyco#11914)
1 parent f235d7b commit 423a899

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/app/src/context/layout.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,15 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
682682
if (!current) return
683683

684684
const all = current.all.filter((x) => x !== tab)
685-
batch(() => {
685+
if (current.active !== tab) {
686686
setStore("sessionTabs", session, "all", all)
687-
if (current.active !== tab) return
687+
return
688+
}
688689

689-
const index = current.all.findIndex((f) => f === tab)
690-
const next = all[index - 1] ?? all[0]
690+
const index = current.all.findIndex((f) => f === tab)
691+
const next = current.all[index - 1] ?? current.all[index + 1] ?? all[0]
692+
batch(() => {
693+
setStore("sessionTabs", session, "all", all)
691694
setStore("sessionTabs", session, "active", next)
692695
})
693696
},

0 commit comments

Comments
 (0)