From d41885f1fc5a21882326a3155405a375159f864c Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 5 Aug 2024 18:09:21 -0300 Subject: [PATCH] Presets second tab as active if a single valued taxonomy metadata already has value. --- .../other/checkbox-radio-metadata-input.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/views/admin/components/other/checkbox-radio-metadata-input.vue b/src/views/admin/components/other/checkbox-radio-metadata-input.vue index cf5b53fb3..0a9505181 100644 --- a/src/views/admin/components/other/checkbox-radio-metadata-input.vue +++ b/src/views/admin/components/other/checkbox-radio-metadata-input.vue @@ -443,6 +443,7 @@ this.initializeValues(); } }); + }, beforeUnmount() { // Cancels previous Request @@ -795,6 +796,24 @@ this.createColumn(res, key, option ? option.label : null); this.isColumnLoading = false; + + // If this is the first time loading, these will be undefined + if ( + option === undefined && + key === undefined && + index === undefined + ) { + // Here we already have a value for the hasToDisplaySearchBar. Thus we can decide if we should + // Preset the second tab as active to display selected values + if ( + ( Array.isArray(this.selected) ? (this.selected.length) : this.selected ) && + this.metadatum.multiple != 'yes' && + this.hasToDisplaySearchBar + ) { + this.fetchSelectedLabels(); + this.activeTab = 1; + } + } }) .catch(error => { this.$console.log(error);