Fixes undefined term value on inital term of item submssion form.

This commit is contained in:
mateuswetah 2021-08-04 14:21:14 -03:00
parent b50c407421
commit 2d618712f3
1 changed files with 1 additions and 1 deletions

View File

@ -145,7 +145,7 @@
getTermsId() {
let values = [];
if (this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input') {
values = this.value.map(term => term.id)
values = this.value.map(term => term.id).filter(term => term !== undefined);
this.valueComponent = (values.length >= 0 && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.multiple === 'no') ? values[0] : values;
} else if (this.value && this.itemMetadatum.metadatum && this.getComponent == 'tainacan-taxonomy-tag-input') {
values = this.value.map((term) => { return { label: term.name, value: term.id } });