fix(tasks): update sub task relations in list view after they were created
Resolves https://kolaente.dev/vikunja/frontend/issues/3853
This commit is contained in:
parent
34e4862c88
commit
818f31c220
@ -149,13 +149,15 @@ async function addTask() {
|
||||
await Promise.all(newTasks)
|
||||
|
||||
const taskRelationService = new TaskRelationService()
|
||||
const allParentTasks = tasksToCreate.filter(t => t.parent !== null).map(t => t.parent)
|
||||
const relations = tasksToCreate.map(async t => {
|
||||
const createdTask = createdTasks[t.title]
|
||||
if (typeof createdTask === 'undefined') {
|
||||
return
|
||||
}
|
||||
|
||||
if (t.parent === null) {
|
||||
const isParent = allParentTasks.includes(t.title)
|
||||
if (t.parent === null && !isParent) {
|
||||
emit('taskAdded', createdTask)
|
||||
return
|
||||
}
|
||||
@ -175,6 +177,9 @@ async function addTask() {
|
||||
// we're only emitting here so that the relation shows up in the project
|
||||
emit('taskAdded', createdTask)
|
||||
|
||||
createdParentTask.relatedTasks[RELATION_KIND.SUBTASK] = [createdTask]
|
||||
emit('taskAdded', createdParentTask)
|
||||
|
||||
return rel
|
||||
})
|
||||
await Promise.all(relations)
|
||||
|
@ -241,9 +241,9 @@ function updateTaskList(task: ITask) {
|
||||
loadTasks()
|
||||
}
|
||||
else {
|
||||
tasks.value = [
|
||||
allTasks.value = [
|
||||
task,
|
||||
...tasks.value,
|
||||
...allTasks.value,
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user