fix(app): create scoped drafts from home (#33578)

This commit is contained in:
Brendan Allan 2026-06-24 11:24:38 +08:00 committed by GitHub
parent 57895586c2
commit a4b9351c0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,6 @@ import {
displayName, displayName,
getProjectAvatarSource, getProjectAvatarSource,
homeProjectDirectories, homeProjectDirectories,
homeProjectNavigation,
type HomeProjectSelection, type HomeProjectSelection,
projectForSession, projectForSession,
sortedRootSessions, sortedRootSessions,
@ -125,6 +124,7 @@ export function NewHome() {
const global = useGlobal() const global = useGlobal()
const command = useCommand() const command = useCommand()
const notification = useNotification() const notification = useNotification()
const tabs = useTabs()
let focusSessionSearch: (() => void) | undefined let focusSessionSearch: (() => void) | undefined
const [state, setState] = createStore({ const [state, setState] = createStore({
search: "", search: "",
@ -261,21 +261,11 @@ export function NewHome() {
openProjectNewSession(conn, project.worktree) openProjectNewSession(conn, project.worktree)
} }
function navigateOnServer(conn: ServerConnection.Any, href: string) {
const next = homeProjectNavigation(server.key, ServerConnection.key(conn), href)
if (!next.server) {
navigate(next.href)
return
}
pendingHomeNavigation = next
server.setActive(next.server)
}
function openProjectNewSession(conn: ServerConnection.Any, directory: string) { function openProjectNewSession(conn: ServerConnection.Any, directory: string) {
const ctx = global.createServerCtx(conn) const ctx = global.createServerCtx(conn)
ctx.projects.open(directory) ctx.projects.open(directory)
ctx.projects.touch(directory) ctx.projects.touch(directory)
navigateOnServer(conn, `/${base64Encode(directory)}/session`) tabs.newDraft({ server: ServerConnection.key(conn), directory })
} }
function editProject(conn: ServerConnection.Any, project: LocalProject) { function editProject(conn: ServerConnection.Any, project: LocalProject) {
@ -304,7 +294,7 @@ export function NewHome() {
const ctx = global.createServerCtx(conn) const ctx = global.createServerCtx(conn)
ctx.projects.open(directory) ctx.projects.open(directory)
ctx.projects.touch(directory) ctx.projects.touch(directory)
navigateOnServer(conn, `/server/${base64Encode(ServerConnection.key(conn))}/session/${session.id}`) navigate(`/server/${base64Encode(ServerConnection.key(conn))}/session/${session.id}`)
} }
function chooseProject(conn: ServerConnection.Any) { function chooseProject(conn: ServerConnection.Any) {