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:
parent
0c2a218260
commit
cdef59fab4
|
|
@ -184,11 +184,17 @@ async function removeWorkspace(id: string) {
|
||||||
try {
|
try {
|
||||||
await invoke("remove_workspace", { id });
|
await invoke("remove_workspace", { id });
|
||||||
config = await invoke<AppConfig>("get_config");
|
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";
|
screen = "setup";
|
||||||
lists = [];
|
|
||||||
tasks = [];
|
|
||||||
activeListId = null;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = String(e);
|
error = String(e);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue