Skip to content

Commit decdd51

Browse files
committed
hide not searchable results when no term (#102401)
1 parent 1acdb07 commit decdd51

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

x-pack/plugins/global_search_providers/public/providers/get_app_results.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ describe('getAppResults', () => {
120120
],
121121
keywords: [],
122122
}),
123+
createApp({
124+
id: 'AppNotSearchable',
125+
title: 'App 1 not searchable',
126+
searchable: false,
127+
}),
123128
];
124129

125130
expect(getAppResults('', apps).length).toBe(1);

x-pack/plugins/global_search_providers/public/providers/get_app_results.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export const getAppResults = (
3131
.flatMap((app) =>
3232
term.length > 0
3333
? flattenDeepLinks(app)
34-
: [
34+
: app.searchable
35+
? [
3536
{
3637
id: app.id,
3738
app,
@@ -40,6 +41,7 @@ export const getAppResults = (
4041
keywords: app.keywords ?? [],
4142
},
4243
]
44+
: []
4345
)
4446
.map((appLink) => ({
4547
appLink,

0 commit comments

Comments
 (0)