From 664bf0a5f48ba872236de6af9c2735e68b47b4b7 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 15 Jan 2024 21:46:47 +0100 Subject: [PATCH] fix(tasks): make sure tasks show up if their parent task is not available in the current view Related https://github.com/go-vikunja/frontend/issues/136 Related https://community.vikunja.io/t/subtasks-are-hidden-when-parent-tasks-are-moved/1911 --- src/views/project/ProjectList.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/views/project/ProjectList.vue b/src/views/project/ProjectList.vue index 35b91c411..ef4a22ffe 100644 --- a/src/views/project/ProjectList.vue +++ b/src/views/project/ProjectList.vue @@ -179,7 +179,23 @@ watch( if (projectId < 0) { return } - tasks.value = tasks.value.filter(t => typeof t.relatedTasks?.parenttask === 'undefined') + const tasksById = {} + tasks.value.forEach(t => tasksById[t.id] = true) + + tasks.value = tasks.value.filter(t => { + if (typeof t.relatedTasks?.parenttask === 'undefined') { + return true + } + + // If the task is a subtask, make sure the parent task is available in the current view as well + for (const pt of t.relatedTasks.parenttask) { + if(typeof tasksById[pt.id] === 'undefined') { + return true + } + } + + return false + }) }, )