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: [] }) + ); +}