From 22e594e253d9f359507b30331dd3b1a2497f2600 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 5 Sep 2024 14:51:47 +0200 Subject: [PATCH] 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 --- frontend/src/components/project/views/ProjectKanban.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/project/views/ProjectKanban.vue b/frontend/src/components/project/views/ProjectKanban.vue index 8cb08d643..1e4d1fb91 100644 --- a/frontend/src/components/project/views/ProjectKanban.vue +++ b/frontend/src/components/project/views/ProjectKanban.vue @@ -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) {