fix: vuex store manipulation warning when modifying task labels
This commit is contained in:
parent
1818ed3648
commit
ff9e1b3fca
1 changed files with 23 additions and 8 deletions
|
@ -179,9 +179,18 @@ export default {
|
||||||
console.debug('Could not add label to task in kanban, task not found', t)
|
console.debug('Could not add label to task in kanban, task not found', t)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
// FIXME: direct store manipulation (task)
|
|
||||||
t.task.labels.push(label)
|
const labels = [...t.task.labels]
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', t, { root: true })
|
labels.push(label)
|
||||||
|
|
||||||
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
|
task: {
|
||||||
|
labels,
|
||||||
|
...t.task,
|
||||||
|
},
|
||||||
|
...t,
|
||||||
|
}, { root: true })
|
||||||
|
|
||||||
return r
|
return r
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -200,15 +209,21 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the label from the list
|
// Remove the label from the list
|
||||||
for (const l in t.task.labels) {
|
const labels = [...t.task.labels]
|
||||||
if (t.task.labels[l].id === label.id) {
|
for (const l in labels) {
|
||||||
// FIXME: direct store manipulation (task)
|
if (labels[l].id === label.id) {
|
||||||
t.task.labels.splice(l, 1)
|
labels.splice(l, 1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true})
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
|
task: {
|
||||||
|
labels,
|
||||||
|
...t.task,
|
||||||
|
},
|
||||||
|
...t,
|
||||||
|
}, {root: true})
|
||||||
|
|
||||||
return response
|
return response
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue