fix(kanban): error when moving a task to an empty bucket

This commit is contained in:
kolaente 2022-07-19 17:13:22 +02:00
parent a4d3cafdf1
commit a0d0c2cb1f
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 1 additions and 2 deletions

View File

@ -436,8 +436,7 @@ export default defineComponent({
await this.$store.dispatch('tasks/update', newTask)
// Make sure the first and second task don't both get position 0 assigned
if(newTaskIndex === 0 && taskAfter.kanbanPosition === 0) {
console.log('first', taskAfter.id, taskAfter.kanbanPosition)
if(newTaskIndex === 0 && taskAfter !== null && taskAfter.kanbanPosition === 0) {
const taskAfterAfter = newBucket.tasks[newTaskIndex + 2] ?? null
const newTaskAfter = cloneDeep(taskAfter) // cloning the task to avoid vuex store mutations
newTaskAfter.bucketId = newBucket.id