From 6283f9ab2c42e9fcc78b9786d5e5bc64a83d1c4a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 17 Apr 2026 16:25:39 +0000 Subject: [PATCH] fix(store): guard fs-changed listener against setup/missing screens The module-scope fs-changed listener fired unconditionally, calling loadLists even when the user was on the setup or missing-workspace screens (where no current workspace exists). The invoke would fail silently and a WebDAV debounced sync could kick off against an incomplete state. Bail when there's no active workspace or the tasks screen isn't mounted. --- apps/tauri/src/lib/stores/app.svelte.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/tauri/src/lib/stores/app.svelte.ts b/apps/tauri/src/lib/stores/app.svelte.ts index 99d0b08..c327c0d 100644 --- a/apps/tauri/src/lib/stores/app.svelte.ts +++ b/apps/tauri/src/lib/stores/app.svelte.ts @@ -10,10 +10,13 @@ import type { } from "../types"; import { groupTasksByDate, type TaskGroup } from "../grouping"; -// Listen for file system changes from the backend watcher. +// Listen for file system changes from the backend watcher. Guard against +// firing while the user is on the setup/missing screens — loadLists would +// fail (no workspace) and a debouncedSync against a non-synced workspace +// would be wasted work. listen("fs-changed", () => { + if (!hasWorkspace || screen !== "tasks") return; loadLists(); - // Debounced sync for WebDAV workspaces on local file changes if (isSyncedWorkspace) debouncedSync(); });