From 8a38dfc3c7aa84e6031e7bdc75f7547fcdbac365 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Fri, 27 Feb 2026 15:42:14 +0100 Subject: [PATCH] fix: deduplicate search results by path in useUnifiedSearch --- src/hooks/useUnifiedSearch.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/hooks/useUnifiedSearch.ts b/src/hooks/useUnifiedSearch.ts index cea1e0b9..08bd7654 100644 --- a/src/hooks/useUnifiedSearch.ts +++ b/src/hooks/useUnifiedSearch.ts @@ -36,13 +36,20 @@ function searchWithTimeout(args: Record, ms: number): Promise ({ - title: r.title, - path: r.path, - snippet: r.snippet, - score: r.score, - noteType: r.note_type, - })) + const seen = new Set() + return raw + .map(r => ({ + title: r.title, + path: r.path, + snippet: r.snippet, + score: r.score, + noteType: r.note_type, + })) + .filter(r => { + if (seen.has(r.path)) return false + seen.add(r.path) + return true + }) } export function useUnifiedSearch(vaultPath: string, active: boolean) {