refactor: simplify forgetMissingWorkspace now that removeWorkspace handles switch
removeWorkspace already switches to the next available workspace (or falls back to setup). forgetMissingWorkspace can just delegate, dropping the duplicate branch that previously never ran anyway because current_workspace was always null after removal.
This commit is contained in:
parent
cdef59fab4
commit
855fa46a0e
|
|
@ -525,22 +525,10 @@ async function addGoogleTasksWorkspace(
|
||||||
|
|
||||||
async function forgetMissingWorkspace() {
|
async function forgetMissingWorkspace() {
|
||||||
if (!missingWorkspace) return;
|
if (!missingWorkspace) return;
|
||||||
|
// removeWorkspace handles switching to the next available workspace (or
|
||||||
|
// falling back to the setup screen when none remain); just delegate.
|
||||||
await removeWorkspace(missingWorkspace);
|
await removeWorkspace(missingWorkspace);
|
||||||
missingWorkspace = null;
|
missingWorkspace = null;
|
||||||
config = await invoke<AppConfig>("get_config");
|
|
||||||
if (hasWorkspace) {
|
|
||||||
// Switch to the next available workspace
|
|
||||||
const nextName = Object.keys(config!.workspaces)[0];
|
|
||||||
if (nextName) {
|
|
||||||
await switchWorkspace(nextName);
|
|
||||||
screen = "tasks";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
screen = "setup";
|
|
||||||
lists = [];
|
|
||||||
tasks = [];
|
|
||||||
activeListId = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setScreen(s: Screen) {
|
function setScreen(s: Screen) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue