Skip to content

Commit c30f06a

Browse files
Brendonovichleohenon
authored andcommitted
fix(app): open next project when closing current one (anomalyco#26987)
1 parent 8da75e1 commit c30f06a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/app/src/pages/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,19 +1409,20 @@ export default function Layout(props: ParentProps) {
14091409
const index = list.findIndex((x) => pathKey(x.worktree) === key)
14101410
const active = pathKey(currentProject()?.worktree ?? "") === key
14111411
if (index === -1) return
1412-
const next = list[index + 1]
14131412

14141413
if (!active) {
14151414
layout.projects.close(directory)
14161415
return
14171416
}
14181417

1419-
if (!next) {
1418+
if (list.length === 1) {
14201419
layout.projects.close(directory)
14211420
navigate("/")
14221421
return
14231422
}
14241423

1424+
const next = list[index + 1] ?? list[index - 1]
1425+
14251426
navigateWithSidebarReset(`/${base64Encode(next.worktree)}/session`)
14261427
layout.projects.close(directory)
14271428
queueMicrotask(() => {

0 commit comments

Comments
 (0)