From 83ce9f1c212f07a451d06aa14721c281c8b15e4a Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:19:06 +0500 Subject: [PATCH] web: fix archived notes showing in search results (#8216) * web: fix archived notes showing in search results Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * core: make notes param required in lookup.notesWithHighlighting Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/mobile/app/screens/search/index.tsx | 4 ++-- apps/web/src/views/all-notes.tsx | 6 +++++- apps/web/src/views/notes.tsx | 2 +- packages/core/src/api/lookup.ts | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/mobile/app/screens/search/index.tsx b/apps/mobile/app/screens/search/index.tsx index a6688c8ad..b973c2531 100644 --- a/apps/mobile/app/screens/search/index.tsx +++ b/apps/mobile/app/screens/search/index.tsx @@ -67,8 +67,8 @@ export const Search = ({ route, navigation }: NavigationProps<"Search">) => { case "note": results = await db.lookup.notesWithHighlighting( query, - groupOptions, - route.params.items as FilteredSelector + route.params.items as FilteredSelector, + groupOptions ); break; diff --git a/apps/web/src/views/all-notes.tsx b/apps/web/src/views/all-notes.tsx index 75eca864c..ca96edf14 100644 --- a/apps/web/src/views/all-notes.tsx +++ b/apps/web/src/views/all-notes.tsx @@ -36,7 +36,11 @@ function Home() { "notes", async (query, sortOptions) => { if (useStore.getState().context) return; - return await db.lookup.notesWithHighlighting(query, sortOptions); + return await db.lookup.notesWithHighlighting( + query, + db.notes.all, + sortOptions + ); }, [notes] ); diff --git a/apps/web/src/views/notes.tsx b/apps/web/src/views/notes.tsx index 71fa016a5..b97a2681f 100644 --- a/apps/web/src/views/notes.tsx +++ b/apps/web/src/views/notes.tsx @@ -47,7 +47,7 @@ function Notes(props: NotesProps) { async (query, sortOptions) => { if (!context || !contextNotes) return; const notes = notesFromContext(context); - return await db.lookup.notesWithHighlighting(query, sortOptions, notes); + return await db.lookup.notesWithHighlighting(query, notes, sortOptions); }, [context, contextNotes] ); diff --git a/packages/core/src/api/lookup.ts b/packages/core/src/api/lookup.ts index 9eb79d41f..7f5826a59 100644 --- a/packages/core/src/api/lookup.ts +++ b/packages/core/src/api/lookup.ts @@ -106,8 +106,8 @@ export default class Lookup { async notesWithHighlighting( query: string, - sortOptions?: SortOptions, - notes?: FilteredSelector + notes: FilteredSelector, + sortOptions?: SortOptions ): Promise> { const db = this.db.sql() as unknown as Kysely; const excludedIds = this.db.trash.cache.notes;