Skip to content

Commit

Permalink
feat: not show recent when have text
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Aug 11, 2024
1 parent 620f3f8 commit a752a21
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { lingo } from '../utils/lingo';
export const plugin = (id: string): AutocompletePlugin<RecentSearchesItem, RecentSearchesPluginData<RecentSearchesItem>> => {
let setContext: StateUpdater<IContext> | undefined;
let refresh: () => Promise<void> | undefined;
const deleteIcon = getIconSvg('$:/core/images/delete-button');
const deleteIcon = getIconSvg('$:/core/images/delete-button', undefined);
const recentSearchesPlugin = createLocalStorageRecentSearchesPlugin({
key: `recent-${id}`,
subscribe(parameters) {
Expand All @@ -26,6 +26,11 @@ export const plugin = (id: string): AutocompletePlugin<RecentSearchesItem, Recen
getItemUrl({ item }) {
return item.id;
},
async getItems(parameters) {
if (parameters.query.length > 0) return [];
const items = source.getItems(parameters);
return await items;
},
onSelect({ item }) {
onSelect(item.id);
},
Expand Down

0 comments on commit a752a21

Please sign in to comment.