Skip to content

Commit

Permalink
UBERF-4486: Fix mention and spotlight categories (#4108)
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
  • Loading branch information
mixerka authored Nov 29, 2023
1 parent 0a7faaf commit f23d061
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/presentation/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ const categoriesByContext = new Map<string, ObjectSearchCategory[]>()

export async function searchFor (context: 'mention' | 'spotlight', query: string): Promise<SearchItem[]> {
const client = getClient()
let categories
if (categoriesByContext.get(context) === undefined) {
let categories = categoriesByContext.get(context)
if (categories === undefined) {
categories = await client.findAll(plugin.class.ObjectSearchCategory, { context })
categoriesByContext.set(context, categories)
}

if (categories === undefined) {
return []
}
Expand Down

0 comments on commit f23d061

Please sign in to comment.