Presets second tab as active if a single valued taxonomy metadata already has value.

This commit is contained in:
mateuswetah 2024-08-05 18:09:21 -03:00
parent 240013e649
commit d41885f1fc
1 changed files with 19 additions and 0 deletions

View File

@ -443,6 +443,7 @@
this.initializeValues(); this.initializeValues();
} }
}); });
}, },
beforeUnmount() { beforeUnmount() {
// Cancels previous Request // Cancels previous Request
@ -795,6 +796,24 @@
this.createColumn(res, key, option ? option.label : null); this.createColumn(res, key, option ? option.label : null);
this.isColumnLoading = false; 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 => { .catch(error => {
this.$console.log(error); this.$console.log(error);