fix: save new views in default workspace

This commit is contained in:
lucaronin
2026-05-18 13:17:11 +02:00
parent 7c307e8baf
commit c6ce5f421b
3 changed files with 60 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
interface ViewCreationVaultPathOptions {
editingRootPath?: string
fallbackVaultPath: string
graphDefaultWorkspacePath: string
multiWorkspaceEnabled: boolean
}
function usablePath(path: string | null | undefined): string | null {
const trimmed = path?.trim()
return trimmed ? trimmed : null
}
export function viewCreationVaultPath({
editingRootPath,
fallbackVaultPath,
graphDefaultWorkspacePath,
multiWorkspaceEnabled,
}: ViewCreationVaultPathOptions): string {
return usablePath(editingRootPath)
?? (multiWorkspaceEnabled ? usablePath(graphDefaultWorkspacePath) : null)
?? fallbackVaultPath
}