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) 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
}, },