fix(sorting): rerender task column for accuracy

This commit is contained in:
Kalista Payne
2026-04-07 15:37:26 -05:00
parent e6ffd69148
commit 3a08de7ab3
3 changed files with 16 additions and 7 deletions
@@ -83,7 +83,7 @@
</div>
</div>
<draggable
v-if="taskList.length > 0"
v-if="taskList.length > 0 && !rerendering"
ref="tasksList"
class="sortable-tasks"
:disabled="activeFilter.label === 'scheduled' || !canBeDragged()"
@@ -432,6 +432,7 @@ export default {
selectedItemToBuy: {},
dragging: false,
rerendering: false,
};
},
computed: {
@@ -548,8 +549,8 @@ export default {
if (this.taskListOverride) originTasks = this.taskListOverride;
// Server
const taskIdToReplace = filteredList[data.newIndex];
const newIndexOnServer = originTasks.findIndex(taskId => taskId === taskIdToReplace);
const taskIdToReplace = filteredList[data.newIndex]._id;
const newIndexOnServer = originTasks.findIndex(task => task._id === taskIdToReplace);
let newOrder;
if (taskToMove.group.id && !this.isUser) {
@@ -568,6 +569,9 @@ export default {
// Client
const deleted = originTasks.splice(data.oldIndex, 1);
originTasks.splice(data.newIndex, 0, deleted[0]);
this.rerendering = true;
await this.$nextTick();
this.rerendering = false;
},
async moveTo (task, where) { // where is 'top' or 'bottom'
const taskIdToMove = task._id;
+1
View File
@@ -4,6 +4,7 @@
:class="{
'casting-spell': castingSpell,
}"
@dragover.prevent
>
<!-- <banned-account-modal /> -->
<amazon-payments-modal v-if="!isStaticPage" />
+8 -4
View File
@@ -158,11 +158,15 @@ export async function collapseChecklist (store, task) {
}
export async function destroy (store, task) {
const list = store.state.tasks.data[`${task.type}s`];
const taskIndex = list.findIndex(t => t._id === task._id);
const type = `${task.type}s`;
const listIndex = store.state.tasks.data[type].findIndex(t => t._id === task._id);
const orderIndex = store.state.user.data.tasksOrder[type].indexOf(task._id);
if (taskIndex > -1) {
list.splice(taskIndex, 1);
if (listIndex > -1) {
store.state.tasks.data[type].splice(listIndex, 1);
}
if (orderIndex > -1) {
store.state.user.data.tasksOrder[type].splice(orderIndex, 1);
}
await axios.delete(`/api/v4/tasks/${task._id}`);