fix: don't try to set the bucket of a task when it was moved to a new list

This commit is contained in:
kolaente 2022-09-05 15:49:21 +02:00 committed by Dominik Pschenitschni
parent 9616badc33
commit c06b781837
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
1 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,9 @@ function getTaskIndicesById(state: KanbanState, taskId: ITask['id']) {
const addTaskToBucketAndSort = (state: KanbanState, task: ITask) => {
const bucketIndex = findIndexById(state.buckets, task.bucketId)
if(typeof state.buckets[bucketIndex] === 'undefined') {
return
}
state.buckets[bucketIndex].tasks.push(task)
state.buckets[bucketIndex].tasks.sort((a, b) => a.kanbanPosition > b.kanbanPosition ? 1 : -1)
}