From 2b6a5181a34b8a27ae04f80fb4176b8de941abc4 Mon Sep 17 00:00:00 2001 From: brooklyn! Date: Tue, 8 Sep 2026 20:00:18 -0500 Subject: [PATCH] fix(desktop): allow project creation while browsing all profiles --- apps/desktop/src/store/projects.ts | 40 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/apps/desktop/src/store/projects.ts b/apps/desktop/src/store/projects.ts index 92cc823a9f..8e2e264373 100644 --- a/apps/desktop/src/store/projects.ts +++ b/apps/desktop/src/store/projects.ts @@ -319,10 +319,8 @@ function stillOnProjectsContext(context: ActiveProjectsContext): boolean { return activeGateway() === context.gateway && projectProfile() === context.profile } -async function activeProjectsContext(): Promise { - const profile = projectProfile() - - if (!profile) { +async function activeProjectsContext(profile = projectProfile()): Promise { + if (!profile || profile === ALL_PROFILES) { throw new Error('Projects are unavailable while viewing all profiles') } @@ -332,7 +330,7 @@ async function activeProjectsContext(): Promise { gateway = await ensureActiveGatewayOpen() } - if (!gateway || gateway !== activeGateway() || profile !== projectProfile()) { + if (!gateway || gateway !== activeGateway() || profile !== normalizeProfileKey($activeGatewayProfile.get())) { throw new Error('Active Hermes profile changed while connecting') } @@ -878,19 +876,27 @@ export async function createProject(input: CreateProjectInput): Promise( + // All profiles filters the sidebar, not the owner of a new project. + // Capture the live route so reconnecting cannot retarget the write. + const context = await activeProjectsContext(normalizeProfileKey($activeGatewayProfile.get())) + + res = await gatewayRequestOn<{ project: ProjectInfo | null }>( + context.gateway, 'projects.create', - projectParams({ - name: input.name, - folders: input.folders ?? [], - primary_path: input.primaryPath, - slug: input.slug, - description: input.description, - icon: input.icon, - color: input.color, - board_slug: input.boardSlug, - use: input.use ?? false - }) + projectParams( + { + name: input.name, + folders: input.folders ?? [], + primary_path: input.primaryPath, + slug: input.slug, + description: input.description, + icon: input.icon, + color: input.color, + board_slug: input.boardSlug, + use: input.use ?? false + }, + context.profile + ) ) } catch (err) { if (isMissingRpcMethod(err)) {