From 5988e50b129fc93eeff404d034efc3f6c0b5166b Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Mon, 7 Sep 2026 14:39:05 +0200 Subject: [PATCH] fix(frontend): reload the list on dismissal, and never re-offer a workspace that exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closing a landed import with the X left the home list stale: only `finish()` reloaded it, so a workspace that now holds a project kept showing its placeholder rows. A run that started wrote items whether it finished, was abandoned or failed partway, so any dismissal after one reloads. Creation reported failure for a failed *list refresh* too, and handed the form back — where a retry picks the next free id and creates a second workspace. Once `createWorkspace` returns, nothing may report failure: the refresh is logged if it fails, and the hand-over proceeds, since the workspace is real either way. The disabled-link tooltip also claimed the settings could not be read during the ordinary load, before anything had failed. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_012fRjnaHLwjpHN84gNNxah9 --- .../components/home/ImportProjectModal.svelte | 5 +++ .../SimpleCreateWorkspace.svelte | 32 +++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/home/ImportProjectModal.svelte b/frontend/src/lib/components/home/ImportProjectModal.svelte index f7ae84aa11..d5f3cde7a4 100644 --- a/frontend/src/lib/components/home/ImportProjectModal.svelte +++ b/frontend/src/lib/components/home/ImportProjectModal.svelte @@ -79,6 +79,11 @@ sendUserToast('Import stopped. What it already added stays; reopen the project to finish.') } } + // A run that started wrote items, whether it finished, was abandoned midway or failed + // partway — so the list behind this dialog is stale either way, and only `finish()` + // was reloading it. Closing a landed import with the X left an emptied-out home + // showing its placeholder rows over a workspace that now holds a project. + if (!finishing && execution) onImported?.() finishing = false onClose() } diff --git a/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte b/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte index de75852a38..9fa93ec3b7 100644 --- a/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte +++ b/frontend/src/lib/components/workspaceSettings/SimpleCreateWorkspace.svelte @@ -118,8 +118,10 @@ creating = true const workspaceName = name.trim() const started = Date.now() + + let id: string | undefined try { - const id = await freeWorkspaceId(idSeed(workspaceName)) + id = await freeWorkspaceId(idSeed(workspaceName)) if (!id) { sendUserToast( 'No workspace ID could be derived from that name. Pick one in advanced settings.', @@ -136,19 +138,29 @@ username: automateUsername ? undefined : suggestedUsername } }) - usersWorkspaceStore.set(await WorkspaceService.listUserWorkspaces()) - switchWorkspace(id) - const left = WORKSPACE_HANDOVER_MS - (Date.now() - started) - if (left > 0) await new Promise((resolve) => setTimeout(resolve, left)) - // Left up rather than cleared: the navigation it hands over to loads the workspace - // layout for the first time, and dropping back to the form under it would show the - // button again for as long as that takes. - onCreated() } catch (error) { console.error('Could not create the workspace:', error) sendUserToast('Could not create the workspace: ' + (error?.body || error?.message), true) creating = false + return } + + // The workspace exists from here on, so nothing below may report failure or hand the + // form back: a retry would pick the next free id and create a second one. A refresh + // that fails is worth a log and nothing more — the list reloads on the next page load, + // and the workspace this hands over to is real either way. + try { + usersWorkspaceStore.set(await WorkspaceService.listUserWorkspaces()) + } catch (error) { + console.error('Created the workspace but could not refresh the list:', error) + } + switchWorkspace(id) + const left = WORKSPACE_HANDOVER_MS - (Date.now() - started) + if (left > 0) await new Promise((resolve) => setTimeout(resolve, left)) + // Left up rather than cleared: the navigation it hands over to loads the workspace + // layout for the first time, and dropping back to the form under it would show the + // button again for as long as that takes. + onCreated() } @@ -197,7 +209,7 @@