Highlight the second item in in the omnibar search results (#4611)

This commit is contained in:
akash-codemonk 2021-06-17 12:24:55 +05:30 committed by GitHub
parent 4f140d4323
commit 6001e69de4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,13 +163,18 @@ function GlobalSearch() {
setQuery(resetSearchQuery);
} else {
dispatch(setGlobalSearchQuery(""));
if (!query) setActiveItemIndex(1);
if (!query)
recentEntities.length > 1
? setActiveItemIndex(2)
: setActiveItemIndex(1);
}
}, [modalOpen]);
useEffect(() => {
setActiveItemIndex(1);
}, [query]);
!query && recentEntities.length > 1
? setActiveItemIndex(2)
: setActiveItemIndex(1);
}, [query, recentEntities.length]);
const filteredWidgets = useMemo(() => {
if (!query) return searchableWidgets;