fix(desktop): allow project creation while browsing all profiles

This commit is contained in:
brooklyn!
2026-09-08 20:00:18 -05:00
parent 9d865810b6
commit 2b6a5181a3
+23 -17
View File
@@ -319,10 +319,8 @@ function stillOnProjectsContext(context: ActiveProjectsContext): boolean {
return activeGateway() === context.gateway && projectProfile() === context.profile
}
async function activeProjectsContext(): Promise<ActiveProjectsContext> {
const profile = projectProfile()
if (!profile) {
async function activeProjectsContext(profile = projectProfile()): Promise<ActiveProjectsContext> {
if (!profile || profile === ALL_PROFILES) {
throw new Error('Projects are unavailable while viewing all profiles')
}
@@ -332,7 +330,7 @@ async function activeProjectsContext(): Promise<ActiveProjectsContext> {
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<ProjectI
let res: { project: ProjectInfo | null }
try {
res = await gatewayRequest<{ project: ProjectInfo | null }>(
// 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)) {