fix(app): open next project when closing current one (#26987)
This commit is contained in:
@@ -1409,19 +1409,20 @@ export default function Layout(props: ParentProps) {
|
|||||||
const index = list.findIndex((x) => pathKey(x.worktree) === key)
|
const index = list.findIndex((x) => pathKey(x.worktree) === key)
|
||||||
const active = pathKey(currentProject()?.worktree ?? "") === key
|
const active = pathKey(currentProject()?.worktree ?? "") === key
|
||||||
if (index === -1) return
|
if (index === -1) return
|
||||||
const next = list[index + 1]
|
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
layout.projects.close(directory)
|
layout.projects.close(directory)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!next) {
|
if (list.length === 1) {
|
||||||
layout.projects.close(directory)
|
layout.projects.close(directory)
|
||||||
navigate("/")
|
navigate("/")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const next = list[index + 1] ?? list[index - 1]
|
||||||
|
|
||||||
navigateWithSidebarReset(`/${base64Encode(next.worktree)}/session`)
|
navigateWithSidebarReset(`/${base64Encode(next.worktree)}/session`)
|
||||||
layout.projects.close(directory)
|
layout.projects.close(directory)
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user