1
0

fix: directly set arrays, objects and delete directly

Not needed since vue3 uses proxies
This commit is contained in:
Dominik Pschenitschni
2021-08-19 21:35:38 +02:00
parent 2b20f328cb
commit db49b9b532
33 changed files with 104 additions and 113 deletions

View File

@ -142,7 +142,7 @@ export default {
const list = new ListModel(listData)
this.listService.get(list)
.then(r => {
this.$set(this, 'list', r)
this.list = r
this.$store.commit(CURRENT_LIST, r)
this.setTitle(this.getListTitle(r))
})

View File

@ -104,8 +104,8 @@ export default {
return
}
// This is an extra method to reset a few things when searching to not break loading more photos.
this.$set(this, 'backgroundSearchResult', [])
this.$set(this, 'backgroundThumbs', {})
this.backgroundSearchResult = []
this.backgroundThumbs = {}
this.searchBackgrounds()
},
searchBackgrounds(page = 1) {
@ -124,7 +124,7 @@ export default {
r.forEach(b => {
this.backgroundService.thumb(b)
.then(t => {
this.$set(this.backgroundThumbs, b.id, t)
this.backgroundThumbs[b.id] = t
})
})
})

View File

@ -106,7 +106,7 @@ export default {
this.listService.get(list)
.then(r => {
this.$set(this, 'list', r)
this.list = r
this.$store.commit(CURRENT_LIST, r)
this.setTitle(this.$t('list.edit.title', {list: this.list.title}))
})

View File

@ -61,7 +61,7 @@ export default {
this.listService.get(list)
.then(r => {
this.$set(this, 'list', r)
this.list = r
this.$store.commit(CURRENT_LIST, r)
// This will trigger the dynamic loading of components once we actually have all the data to pass to them
this.manageTeamsComponent = 'userTeam'

View File

@ -398,20 +398,20 @@ export default {
this.$message.error(e)
})
.finally(() => {
this.$set(this.taskUpdating, task.id, false)
this.taskUpdating[task.id] = false
this.oneTaskUpdating = false
})
},
toggleShowNewTaskInput(bucket) {
this.$set(this.showNewTaskInput, bucket, !this.showNewTaskInput[bucket])
this.showNewTaskInput[bucket] = !this.showNewTaskInput[bucket]
},
addTaskToBucket(bucketId) {
if (this.newTaskText === '') {
this.$set(this.newTaskError, bucketId, true)
this.newTaskError[bucketId] = true
return
}
this.$set(this.newTaskError, bucketId, false)
this.newTaskError[bucketId] = false
this.createNewTask(this.newTaskText, bucketId)
.then(r => {
@ -557,7 +557,7 @@ export default {
})
},
collapseBucket(bucket) {
this.$set(this.collapsedBuckets, bucket.id, true)
this.collapsedBuckets[bucket.id] = true
saveCollapsedBucketState(this.$route.params.listId, this.collapsedBuckets)
},
unCollapseBucket(bucket) {
@ -565,7 +565,7 @@ export default {
return
}
this.$set(this.collapsedBuckets, bucket.id, false)
this.collapsedBuckets[bucket.id] = false
saveCollapsedBucketState(this.$route.params.listId, this.collapsedBuckets)
},
},

View File

@ -279,7 +279,7 @@ export default {
updateTasks(updatedTask) {
for (const t in this.tasks) {
if (this.tasks[t].id === updatedTask.id) {
this.$set(this.tasks, t, updatedTask)
this.tasks[t] = updatedTask
break
}
}
@ -299,7 +299,7 @@ export default {
this.$store.dispatch('tasks/update', newTask)
.then(r => {
this.$set(this.tasks, e.newIndex, r)
this.tasks[e.newIndex] = r
})
.catch(e => {
this.$message.error(e)

View File

@ -239,16 +239,16 @@ export default {
created() {
const savedShowColumns = localStorage.getItem('tableViewColumns')
if (savedShowColumns !== null) {
this.$set(this, 'activeColumns', JSON.parse(savedShowColumns))
this.activeColumns = JSON.parse(savedShowColumns)
}
const savedSortBy = localStorage.getItem('tableViewSortBy')
if (savedSortBy !== null) {
this.$set(this, 'sortBy', JSON.parse(savedSortBy))
this.sortBy = JSON.parse(savedSortBy)
}
this.$set(this.params, 'filter_by', [])
this.$set(this.params, 'filter_value', [])
this.$set(this.params, 'filter_comparator', [])
this.params.filter_by = []
this.params.filter_value = []
this.params.filter_comparator = []
this.initTasks(1)
@ -286,11 +286,11 @@ export default {
sort(property) {
const order = this.sortBy[property]
if (typeof order === 'undefined' || order === 'none') {
this.$set(this.sortBy, property, 'desc')
this.sortBy[property] = 'desc'
} else if (order === 'desc') {
this.$set(this.sortBy, property, 'asc')
this.sortBy[property] = 'asc'
} else {
this.$delete(this.sortBy, property)
delete this.sortBy[property]
}
this.initTasks(this.currentPage, this.searchTerm)
// Save the order to be able to retrieve them later