fix: error out when arrow key navigation done on spotlight when no results

This commit is contained in:
Andrew Bastin
2023-07-09 21:56:08 +05:30
parent 3340d0813c
commit 53e4863a80
3 changed files with 24 additions and 10 deletions

View File

@@ -67,6 +67,7 @@
"jsonpath-plus": "^7.0.0",
"lodash-es": "^4.17.21",
"lossless-json": "^2.0.8",
"minisearch": "^6.1.0",
"nprogress": "^0.2.0",
"paho-mqtt": "^1.1.0",
"path": "^0.12.7",

View File

@@ -145,6 +145,9 @@ function newUseArrowKeysForNavigation() {
})
const onArrowDown = () => {
// If no entries, do nothing
if (scoredResults.value.length === 0) return
const [sectionIndex, entryIndex] = selectedEntry.value
const [, section] = scoredResults.value[sectionIndex]
@@ -159,6 +162,9 @@ function newUseArrowKeysForNavigation() {
}
const onArrowUp = () => {
// If no entries, do nothing
if (scoredResults.value.length === 0) return
const [sectionIndex, entryIndex] = selectedEntry.value
if (entryIndex > 0) {