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
No known key found for this signature in database
GPG key ID: B257AC0149F43A77

View file

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