From 3456808e1c87c8d4a5ae1412a185f30fd8b28c91 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 16 Mar 2026 19:19:38 -0500 Subject: [PATCH] Fix workspace codebase form not allowing empty saves and not auto-updating - Allow saving empty values to clear repo URL or local folder from an existing workspace - submitLocalWorkspace/submitRepoWorkspace now handle empty input as a "clear" operation - Save button is only disabled for empty input when there's no existing workspace to clear - removeWorkspace.onSuccess now resets form state (matching create/update handlers) Co-Authored-By: Paperclip Co-Authored-By: Claude Opus 4.6 --- ui/src/components/ProjectProperties.tsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ui/src/components/ProjectProperties.tsx b/ui/src/components/ProjectProperties.tsx index 772bb8db..7d833209 100644 --- a/ui/src/components/ProjectProperties.tsx +++ b/ui/src/components/ProjectProperties.tsx @@ -223,7 +223,13 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa const removeWorkspace = useMutation({ mutationFn: (workspaceId: string) => projectsApi.removeWorkspace(project.id, workspaceId), - onSuccess: invalidateProject, + onSuccess: () => { + setWorkspaceCwd(""); + setWorkspaceRepoUrl(""); + setWorkspaceMode(null); + setWorkspaceError(null); + invalidateProject(); + }, }); const updateWorkspace = useMutation({ mutationFn: ({ workspaceId, data }: { workspaceId: string; data: Record }) => @@ -322,6 +328,11 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa const submitLocalWorkspace = () => { const cwd = workspaceCwd.trim(); + if (!cwd) { + setWorkspaceError(null); + persistCodebase({ cwd: null }); + return; + } if (!isAbsolutePath(cwd)) { setWorkspaceError("Local folder must be a full absolute path."); return; @@ -332,6 +343,11 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa const submitRepoWorkspace = () => { const repoUrl = workspaceRepoUrl.trim(); + if (!repoUrl) { + setWorkspaceError(null); + persistCodebase({ repoUrl: null }); + return; + } if (!isGitHubRepoUrl(repoUrl)) { setWorkspaceError("Repo must use a valid GitHub repo URL."); return; @@ -678,7 +694,7 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa variant="outline" size="xs" className="h-6 px-2" - disabled={!workspaceCwd.trim() || createWorkspace.isPending || updateWorkspace.isPending} + disabled={(!workspaceCwd.trim() && !primaryCodebaseWorkspace) || createWorkspace.isPending || updateWorkspace.isPending} onClick={submitLocalWorkspace} > Save @@ -711,7 +727,7 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa variant="outline" size="xs" className="h-6 px-2" - disabled={!workspaceRepoUrl.trim() || createWorkspace.isPending || updateWorkspace.isPending} + disabled={(!workspaceRepoUrl.trim() && !primaryCodebaseWorkspace) || createWorkspace.isPending || updateWorkspace.isPending} onClick={submitRepoWorkspace} > Save