Fix other values getting pushed away when creating a new one through multiselect

This commit is contained in:
kolaente 2021-07-22 21:57:33 +02:00
parent 028dbf27ee
commit cf25e96c50
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -222,7 +222,7 @@ export default {
}) })
}, },
filteredSearchResults() { filteredSearchResults() {
if (this.multiple && this.internalValue !== null) { if (this.multiple && this.internalValue !== null && Array.isArray(this.internalValue)) {
return this.searchResults.filter(item => !this.internalValue.some(e => e === item)) return this.searchResults.filter(item => !this.internalValue.some(e => e === item))
} }
@ -282,6 +282,9 @@ export default {
this.closeSearchResults() this.closeSearchResults()
}, },
setSelectedObject(object, resetOnly = false) { setSelectedObject(object, resetOnly = false) {
if (!Array.isArray(object)) {
object = [object]
}
this.$set(this, 'internalValue', object) this.$set(this, 'internalValue', object)
// We assume we're getting an array when multiple is enabled and can therefore leave the query // We assume we're getting an array when multiple is enabled and can therefore leave the query