From 9662eb72640178edbd34f29d07e1f2f1093de203 Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Wed, 17 May 2023 19:01:16 +0200 Subject: [PATCH] Improve the logic of the select and select_search components > There is no need for the two components to hold their `value` state. It can be propagated from the component that uses them. This will help 'clear' the search when modification is finished. --- .../vue/assign_items_to_tasks_modal/container.vue | 3 +++ app/javascript/vue/shared/select.vue | 5 ++--- app/javascript/vue/shared/select_search.vue | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/javascript/vue/assign_items_to_tasks_modal/container.vue b/app/javascript/vue/assign_items_to_tasks_modal/container.vue index b0f30b4f9..feb53a36f 100644 --- a/app/javascript/vue/assign_items_to_tasks_modal/container.vue +++ b/app/javascript/vue/assign_items_to_tasks_modal/container.vue @@ -39,6 +39,7 @@ [] }, initialValue: { type: [String, Number] }, placeholder: { type: String }, @@ -25,7 +26,6 @@ }, data() { return { - value: null, isOpen: false, optionPositionStyle: '' } @@ -66,8 +66,7 @@ } }, setValue(value) { - this.value = value; - this.$emit('change', this.value); + this.$emit('change', value); }, updateOptionPosition() { const container = this.$refs.container; diff --git a/app/javascript/vue/shared/select_search.vue b/app/javascript/vue/shared/select_search.vue index 88249ef97..7bdb79b55 100644 --- a/app/javascript/vue/shared/select_search.vue +++ b/app/javascript/vue/shared/select_search.vue @@ -1,5 +1,5 @@