fix(kanban): save updated position to store
This fixes a bug where the position of a task would not be calculated correctly when the task was moved next to another recently moved task. The problem was caused by the calculation of the new position referring to the old value of the position attribute, because it was not updated in the local store. Resolves https://community.vikunja.io/t/kanban-cards-in-wrong-order/2731/6 (cherry picked from commit 22e594e253d9f359507b30331dd3b1a2497f2600)
This commit is contained in:
parent
6da9bc964e
commit
761d278b9a
@ -512,6 +512,7 @@ async function updateTaskPosition(e) {
|
||||
taskId: newTask.id,
|
||||
})
|
||||
await taskPositionService.value.update(newPosition)
|
||||
newTask.position = position
|
||||
|
||||
if(bucketHasChanged) {
|
||||
const updatedTaskBucket = await taskBucketService.value.update(new TaskBucketModel({
|
||||
@ -524,8 +525,8 @@ async function updateTaskPosition(e) {
|
||||
if (updatedTaskBucket.bucketId !== newTask.bucketId) {
|
||||
kanbanStore.moveTaskToBucket(newTask, updatedTaskBucket.bucketId)
|
||||
}
|
||||
kanbanStore.setTaskInBucket(newTask)
|
||||
}
|
||||
kanbanStore.setTaskInBucket(newTask)
|
||||
|
||||
// Make sure the first and second task don't both get position 0 assigned
|
||||
if (newTaskIndex === 0 && taskAfter !== null && taskAfter.position === 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user