hide not searchable results when no term (#102401)

This commit is contained in:
Sergi Massaneda 2021-06-17 10:17:17 +02:00 committed by GitHub
parent 4447ca2a16
commit d92ddf4b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -120,6 +120,11 @@ describe('getAppResults', () => {
],
keywords: [],
}),
createApp({
id: 'AppNotSearchable',
title: 'App 1 not searchable',
searchable: false,
}),
];
expect(getAppResults('', apps).length).toBe(1);

View file

@ -31,7 +31,8 @@ export const getAppResults = (
.flatMap((app) =>
term.length > 0
? flattenDeepLinks(app)
: [
: app.searchable
? [
{
id: app.id,
app,
@ -40,6 +41,7 @@ export const getAppResults = (
keywords: app.keywords ?? [],
},
]
: []
)
.map((appLink) => ({
appLink,