fix: vuex store manipulation warning when modifying task labels
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2022-01-18 22:12:08 +01:00
parent 1818ed3648
commit ff9e1b3fca
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 23 additions and 8 deletions

View File

@ -179,9 +179,18 @@ export default {
console.debug('Could not add label to task in kanban, task not found', t)
return r
}
// FIXME: direct store manipulation (task)
t.task.labels.push(label)
ctx.commit('kanban/setTaskInBucketByIndex', t, { root: true })
const labels = [...t.task.labels]
labels.push(label)
ctx.commit('kanban/setTaskInBucketByIndex', {
task: {
labels,
...t.task,
},
...t,
}, { root: true })
return r
},
@ -200,15 +209,21 @@ export default {
}
// Remove the label from the list
for (const l in t.task.labels) {
if (t.task.labels[l].id === label.id) {
// FIXME: direct store manipulation (task)
t.task.labels.splice(l, 1)
const labels = [...t.task.labels]
for (const l in labels) {
if (labels[l].id === label.id) {
labels.splice(l, 1)
break
}
}
ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true})
ctx.commit('kanban/setTaskInBucketByIndex', {
task: {
labels,
...t.task,
},
...t,
}, {root: true})
return response
},