fix: search on enter
This commit is contained in:
1 parent
c8c3318576
commit
f062aad2b4
1 file changed
+5
-2
@@ -64,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const debouncedSearch = debounce((term: string) => {
|
function searchGroup(term: string) {
|
||||||
if (term.length < 1) {
|
if (term.length < 1) {
|
||||||
if (breadcrumbs.length <= 0) {
|
if (breadcrumbs.length <= 0) {
|
||||||
filteredGroups = groups.map((group) => ({
|
filteredGroups = groups.map((group) => ({
|
||||||
@@ -98,7 +98,9 @@
|
|||||||
.filter((group) => group.actions.length > 0)
|
.filter((group) => group.actions.length > 0)
|
||||||
.sort((a, b) => b.score - a.score)
|
.sort((a, b) => b.score - a.score)
|
||||||
}
|
}
|
||||||
}, 50)
|
}
|
||||||
|
|
||||||
|
const debouncedSearch = debounce((term: string) => searchGroup(term), 50)
|
||||||
|
|
||||||
function updateFilteredGroups() {
|
function updateFilteredGroups() {
|
||||||
if (breadcrumbs.length === 0) {
|
if (breadcrumbs.length === 0) {
|
||||||
@@ -177,6 +179,7 @@
|
|||||||
focusItem(selectedIndex)
|
focusItem(selectedIndex)
|
||||||
break
|
break
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
|
searchGroup(search)
|
||||||
handleSelect(flattenedActions[selectedIndex])
|
handleSelect(flattenedActions[selectedIndex])
|
||||||
break
|
break
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
|
|||||||
Reference in new issue
Block a user