From cdef59fab4e3fdde58d04ea3a1dc4e28e421f499 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 17 Apr 2026 16:12:49 +0000 Subject: [PATCH] fix: keep user on tasks screen when removing current workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a user deletes the current workspace from settings, the backend clears current_workspace and the frontend's hasWorkspace derived fell through to the setup screen — even if the user still had other healthy workspaces configured. Mirror the forgetMissingWorkspace flow: switch to the next available workspace automatically. --- apps/tauri/src/lib/stores/app.svelte.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/tauri/src/lib/stores/app.svelte.ts b/apps/tauri/src/lib/stores/app.svelte.ts index 10031b6..18f17e5 100644 --- a/apps/tauri/src/lib/stores/app.svelte.ts +++ b/apps/tauri/src/lib/stores/app.svelte.ts @@ -184,11 +184,17 @@ async function removeWorkspace(id: string) { try { await invoke("remove_workspace", { id }); config = await invoke("get_config"); - if (!hasWorkspace) { + activeListId = null; + tasks = []; + lists = []; + // Switch to the next available workspace rather than dumping the user + // to the setup screen when they still have other workspaces. + const remaining = Object.keys(config?.workspaces ?? {}); + if (remaining.length > 0) { + await switchWorkspace(remaining[0]); + screen = "tasks"; + } else { screen = "setup"; - lists = []; - tasks = []; - activeListId = null; } } catch (e) { error = String(e);