From 4b3976b784efb3465ab1755b6e67dbec48df37dd Mon Sep 17 00:00:00 2001 From: root Date: Sun, 13 Aug 2023 18:16:41 +0530 Subject: [PATCH] Revert "Potential search menu improvements" This reverts commit 9e1fc4399359f8845f06d2131cf29d8c49381031. --- src/routes/SearchMenu.vue | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/routes/SearchMenu.vue b/src/routes/SearchMenu.vue index 4c796ed..7b87340 100644 --- a/src/routes/SearchMenu.vue +++ b/src/routes/SearchMenu.vue @@ -31,7 +31,7 @@ export default { select: '', searchText: '', requestInProgress: false, - actualSuggestions: [], + searchSuggestions: [], mdiMagnify } @@ -61,15 +61,6 @@ export default { } } }, - computed: { - searchSuggestions () { - if (this.searchText.length === 0) { - return this.actualSuggestions - } else { - return [this.searchText].concat(this.actualSuggestions) - } - } - }, methods: { refreshSuggestions: _debounce(async function refreshSuggestions () { @@ -81,7 +72,15 @@ export default { } }) - this.actualSuggestions = suggestions + { + const idx = suggestions.indexOf(this.searchText) + if (idx !== -1) { + suggestions.splice(idx, 1) + } + } + suggestions.unshift(this.searchText) + + this.searchSuggestions = suggestions this.requestInProgress = false }, 500) },