Fix:Update authors in different order #1361

This commit is contained in:
advplyr 2023-01-04 17:21:25 -06:00
parent 74388fe0b9
commit 88bd51e2da
2 changed files with 19 additions and 10 deletions

View File

@ -204,15 +204,21 @@ export default {
} }
if (this.$refs.input) this.$refs.input.focus() if (this.$refs.input) this.$refs.input.focus()
var newSelected = null let newSelected = null
if (this.getIsSelected(item.id)) { if (this.getIsSelected(item.id)) {
newSelected = this.selected.filter((s) => s.id !== item.id) newSelected = this.selected.filter((s) => s.id !== item.id)
this.$emit('removedItem', item.id) this.$emit('removedItem', item.id)
} else { } else {
newSelected = this.selected.concat([item]) newSelected = this.selected.concat([
{
id: item.id,
name: item.name
}
])
} }
this.textInput = null this.textInput = null
this.currentSearch = null this.currentSearch = null
this.$emit('input', newSelected) this.$emit('input', newSelected)
this.$nextTick(() => { this.$nextTick(() => {
this.recalcMenuPos() this.recalcMenuPos()
@ -246,10 +252,11 @@ export default {
submitForm() { submitForm() {
if (!this.textInput) return if (!this.textInput) return
var cleaned = this.textInput.trim() const cleaned = this.textInput.trim()
var matchesItem = this.items.find((i) => { const matchesItem = this.items.find((i) => {
return i === cleaned return i.name === cleaned
}) })
if (matchesItem) { if (matchesItem) {
this.clickedOption(null, matchesItem) this.clickedOption(null, matchesItem)
} else { } else {

View File

@ -210,11 +210,13 @@ export default {
// array of objects with id key // array of objects with id key
if (array1.length !== array2.length) return false if (array1.length !== array2.length) return false
for (var item of array1) { for (let i = 0; i < array1.length; i++) {
var matchingItem = array2.find((a) => a.id === item.id) const item1 = array1[i]
if (!matchingItem) return false const item2 = array2[i]
for (var key in item) { if (!item1 || !item2) return false
if (item[key] !== matchingItem[key]) {
for (const key in item1) {
if (item1[key] !== item2[key]) {
// console.log('Object array item keys changed', key, item[key], matchingItem[key]) // console.log('Object array item keys changed', key, item[key], matchingItem[key])
return false return false
} }