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:
Tristan Michael 2026-04-06 09:10:36 -07:00 committed by GitButler
parent 8772338e0e
commit f5295b5980
4 changed files with 6 additions and 1 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text=auto eol=lf

View file

@ -60,7 +60,9 @@
{:else if app.screen === "setup"} {:else if app.screen === "setup"}
<SetupScreen cancellable={app.hasWorkspace} /> <SetupScreen cancellable={app.hasWorkspace} />
{:else} {:else}
<TasksScreen /> {#key app.config?.current_workspace}
<TasksScreen />
{/key}
{/if} {/if}
</div> </div>
</div> </div>

View file

@ -25,6 +25,7 @@
} }
}); });
function openTask(task: Task) { function openTask(task: Task) {
taskStack = [task.id]; taskStack = [task.id];
} }

View file

@ -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));