fix: reset tasks and remount screen on workspace change
Reset the tasks array when switching workspaces to prevent stale task data from persisting. Wrap TasksScreen in a keyed block to force remounting when the current workspace changes, ensuring a clean state for each workspace. Configure line endings to use LF across all files for consistency.
This commit is contained in:
parent
8772338e0e
commit
f5295b5980
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
@ -60,7 +60,9 @@
|
||||||
{:else if app.screen === "setup"}
|
{:else if app.screen === "setup"}
|
||||||
<SetupScreen cancellable={app.hasWorkspace} />
|
<SetupScreen cancellable={app.hasWorkspace} />
|
||||||
{:else}
|
{:else}
|
||||||
|
{#key app.config?.current_workspace}
|
||||||
<TasksScreen />
|
<TasksScreen />
|
||||||
|
{/key}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function openTask(task: Task) {
|
function openTask(task: Task) {
|
||||||
taskStack = [task.id];
|
taskStack = [task.id];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ async function switchWorkspace(id: string) {
|
||||||
await invoke("set_current_workspace", { id });
|
await invoke("set_current_workspace", { id });
|
||||||
config = await invoke<AppConfig>("get_config");
|
config = await invoke<AppConfig>("get_config");
|
||||||
activeListId = null;
|
activeListId = null;
|
||||||
|
tasks = [];
|
||||||
await loadLists();
|
await loadLists();
|
||||||
const ws = config?.workspaces[id];
|
const ws = config?.workspaces[id];
|
||||||
if (ws) invoke("watch_workspace", { path: ws.path }).catch((e) => console.warn("File watcher failed:", e));
|
if (ws) invoke("watch_workspace", { path: ws.path }).catch((e) => console.warn("File watcher failed:", e));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue