fix(tasks): update sub task relations in list view after they were created
continuous-integration/drone/push Build is passing Details

Resolves #3853
This commit is contained in:
kolaente 2023-12-13 19:15:48 +01:00
parent 34e4862c88
commit 818f31c220
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 3 deletions

View File

@ -149,13 +149,15 @@ async function addTask() {
await Promise.all(newTasks) await Promise.all(newTasks)
const taskRelationService = new TaskRelationService() const taskRelationService = new TaskRelationService()
const allParentTasks = tasksToCreate.filter(t => t.parent !== null).map(t => t.parent)
const relations = tasksToCreate.map(async t => { const relations = tasksToCreate.map(async t => {
const createdTask = createdTasks[t.title] const createdTask = createdTasks[t.title]
if (typeof createdTask === 'undefined') { if (typeof createdTask === 'undefined') {
return return
} }
if (t.parent === null) { const isParent = allParentTasks.includes(t.title)
if (t.parent === null && !isParent) {
emit('taskAdded', createdTask) emit('taskAdded', createdTask)
return return
} }
@ -175,6 +177,9 @@ async function addTask() {
// we're only emitting here so that the relation shows up in the project // we're only emitting here so that the relation shows up in the project
emit('taskAdded', createdTask) emit('taskAdded', createdTask)
createdParentTask.relatedTasks[RELATION_KIND.SUBTASK] = [createdTask]
emit('taskAdded', createdParentTask)
return rel return rel
}) })
await Promise.all(relations) await Promise.all(relations)

View File

@ -241,9 +241,9 @@ function updateTaskList(task: ITask) {
loadTasks() loadTasks()
} }
else { else {
tasks.value = [ allTasks.value = [
task, task,
...tasks.value, ...allTasks.value,
] ]
} }