From db8408f62fb9fcab2cb945976875ebc8e5c9768a Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 21 Jul 2026 14:07:10 +0500 Subject: [PATCH] core: fix notes lookup with non-existent tags --- packages/core/src/api/lookup.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/core/src/api/lookup.ts b/packages/core/src/api/lookup.ts index d1ae43f00..ab7eaa620 100644 --- a/packages/core/src/api/lookup.ts +++ b/packages/core/src/api/lookup.ts @@ -155,6 +155,12 @@ export default class Lookup { ? await this.db.notebooks.all.ids() : []; + if ( + (!!tag?.length && tag.length !== tagIds.length) || + (!!color?.length && color.length !== colorIds.length) + ) + return emptySearchResults(); + const defaultVault = await this.db.vaults.default(); notes = notes.where((eb) => { const exprs = []; @@ -1212,3 +1218,12 @@ function highlightRegexMatches( function removeDiacritics(s: string) { return s.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } + +function emptySearchResults() { + return new VirtualizedGrouping( + 0, + 20, + () => Promise.resolve([]), + () => Promise.resolve({ ids: [], items: [] }) + ); +}