fix: keep user on tasks screen when removing current workspace

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.
This commit is contained in:
Claude 2026-04-17 16:12:49 +00:00
parent 0c2a218260
commit cdef59fab4
No known key found for this signature in database

View file

@ -184,11 +184,17 @@ async function removeWorkspace(id: string) {
try {
await invoke("remove_workspace", { id });
config = await invoke<AppConfig>("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);