fix(task): new tasks with quick add magic not showing up in task list
This commit is contained in:
parent
5585966584
commit
2f2fb357c1
1 changed files with 6 additions and 4 deletions
|
@ -162,7 +162,9 @@ async function addTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskTitleBackup = newTaskTitle.value
|
const taskTitleBackup = newTaskTitle.value
|
||||||
const createdTasks: ITask[] = []
|
// This allows us to find the tasks with the title they had before being parsed
|
||||||
|
// by quick add magic.
|
||||||
|
const createdTasks: { [key: ITask['title']]: ITask } = {}
|
||||||
const tasksToCreate = parseSubtasksViaIndention(newTaskTitle.value)
|
const tasksToCreate = parseSubtasksViaIndention(newTaskTitle.value)
|
||||||
const newTasks = tasksToCreate.map(async ({title}) => {
|
const newTasks = tasksToCreate.map(async ({title}) => {
|
||||||
if (title === '') {
|
if (title === '') {
|
||||||
|
@ -174,7 +176,7 @@ async function addTask() {
|
||||||
listId: authStore.settings.defaultListId,
|
listId: authStore.settings.defaultListId,
|
||||||
position: props.defaultPosition,
|
position: props.defaultPosition,
|
||||||
})
|
})
|
||||||
createdTasks.push(task)
|
createdTasks[title] = task
|
||||||
return task
|
return task
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -184,7 +186,7 @@ async function addTask() {
|
||||||
|
|
||||||
const taskRelationService = new TaskRelationService()
|
const taskRelationService = new TaskRelationService()
|
||||||
const relations = tasksToCreate.map(async t => {
|
const relations = tasksToCreate.map(async t => {
|
||||||
const createdTask = createdTasks.find(ct => ct.title === t.title)
|
const createdTask = createdTasks[t.title]
|
||||||
if (typeof createdTask === 'undefined') {
|
if (typeof createdTask === 'undefined') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -194,7 +196,7 @@ async function addTask() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const createdParentTask = createdTasks.find(ct => ct.title === t.parent)
|
const createdParentTask = createdTasks[t.parent]
|
||||||
if (typeof createdTask === 'undefined' || typeof createdParentTask === 'undefined') {
|
if (typeof createdTask === 'undefined' || typeof createdParentTask === 'undefined') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue