From b802f17504769b906f5b722c764b3178911a9dfc Mon Sep 17 00:00:00 2001 From: Romain LE DISEZ Date: Sun, 7 Jun 2026 10:04:14 +0000 Subject: [PATCH] fix: preserve search results when background sync runs Keep canonical notes separate from active search results so periodic reloads no longer replace the filtered view. Cancel superseded requests and ignore stale responses to prevent older queries from overwriting newer results. Reconcile results with canonical notes so updates propagate and removed or trashed notes disappear. Add unit and end-to-end coverage for reconciliation, background sync, and out-of-order search responses. Co-authored-by: Google Gemini --- src/lib/components/SearchBar.svelte | 58 +++++++++++++++++++---------- src/lib/stores/notes.test.ts | 16 +++++++- src/lib/stores/notes.ts | 27 ++++++++++++-- tests/e2e/search.spec.ts | 52 ++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 24 deletions(-) diff --git a/src/lib/components/SearchBar.svelte b/src/lib/components/SearchBar.svelte index 32c517a..fdbcf18 100644 --- a/src/lib/components/SearchBar.svelte +++ b/src/lib/components/SearchBar.svelte @@ -1,9 +1,10 @@