From 0055acad9d43efae971cf9ad4e9a89cb2db201bb Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 16 Oct 2023 01:12:56 +0200 Subject: [PATCH] [UI] Fixed `Autocomplete` behaviour on empty filter. --- .../webapp/src/components/elements/Autocomplete.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/elements/Autocomplete.vue b/platypush/backend/http/webapp/src/components/elements/Autocomplete.vue index d63dc11551..5d49a8b444 100644 --- a/platypush/backend/http/webapp/src/components/elements/Autocomplete.vue +++ b/platypush/backend/http/webapp/src/components/elements/Autocomplete.vue @@ -25,8 +25,8 @@ v-for="(item, i) in visibleItems" @click="onItemSelect(item)" > - {{ item.substr(0, value.length) }} - {{ item.substr(value.length) }} + {{ item.substr(0, value.length) }} + {{ item.substr(value?.length || 0) }} @@ -80,6 +80,9 @@ export default { computed: { visibleItems() { + if (!this.value?.length) + return this.items + const val = this.value.toUpperCase() if (!val?.length) return this.showResultsWhenBlank ? this.items : [] @@ -125,6 +128,9 @@ export default { }, valueIsInItems() { + if (!this.value) + return false + return this.items.indexOf(this.value) >= 0 },