From 68d78f2f5b6de3c2ec82b7e8c099d21ac6ad2bfe Mon Sep 17 00:00:00 2001 From: Stefan de Vogelaere Date: Fri, 23 Jan 2026 02:37:10 +0100 Subject: [PATCH] fix(ui): verify initializeProject succeeds before mutating state Check the return value of initializeProject in all three create handlers (handleCreateBlankProject, handleCreateFromTemplate, handleCreateFromCustomUrl) and return early with an error toast if initialization fails, preventing addProject/setCurrentProject/navigate from being called on failure. Co-Authored-By: Claude Opus 4.5 --- .../ui/src/components/views/overview-view.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/apps/ui/src/components/views/overview-view.tsx b/apps/ui/src/components/views/overview-view.tsx index 6a40ed0d..524ce8ed 100644 --- a/apps/ui/src/components/views/overview-view.tsx +++ b/apps/ui/src/components/views/overview-view.tsx @@ -129,7 +129,14 @@ export function OverviewView() { const projectPath = `${parentDir}/${projectName}`; await api.mkdir(projectPath); - await initializeProject(projectPath); + + const initResult = await initializeProject(projectPath); + if (!initResult.success) { + toast.error('Failed to initialize project', { + description: initResult.error || 'Unknown error occurred', + }); + return; + } await api.writeFile( `${projectPath}/.automaker/app_spec.txt`, @@ -185,7 +192,13 @@ export function OverviewView() { return; } - await initializeProject(cloneResult.projectPath); + const initResult = await initializeProject(cloneResult.projectPath); + if (!initResult.success) { + toast.error('Failed to initialize project', { + description: initResult.error || 'Unknown error occurred', + }); + return; + } const project = { id: `project-${Date.now()}`, @@ -228,7 +241,13 @@ export function OverviewView() { return; } - await initializeProject(cloneResult.projectPath); + const initResult = await initializeProject(cloneResult.projectPath); + if (!initResult.success) { + toast.error('Failed to initialize project', { + description: initResult.error || 'Unknown error occurred', + }); + return; + } const project = { id: `project-${Date.now()}`,