fix: show subtasks in saved filter views regardless of parent presence

Add isFilteredView parameter to shouldShowTaskInListView() that skips
the parent-hiding logic when viewing tasks through a saved filter.
This ensures all filter-matching tasks are shown.

Ref: #2494
This commit is contained in:
kolaente 2026-04-02 18:58:10 +02:00 committed by kolaente
parent 616ac8b95f
commit d895053d2e
1 changed files with 10 additions and 0 deletions

View File

@ -6,14 +6,24 @@ import type {ITask} from '@/modelTypes/ITask'
* Subtasks are hidden only when their parent task is also in the current view
* (same project). Cross-project subtasks remain visible.
*
* In filtered views (saved filters), all tasks are shown regardless of parent
* presence, since the user explicitly filtered for them.
*
* @param task - The task to check
* @param allTasksInView - All tasks currently visible in the view
* @param isFilteredView - Whether the current view is a saved/custom filter
* @returns true if the task should be shown, false if it should be hidden
*/
export function shouldShowTaskInListView(
task: ITask,
allTasksInView: ITask[],
isFilteredView: boolean = false,
): boolean {
// In filtered views (saved filters), show all tasks that matched the filter
if (isFilteredView) {
return true
}
// If task has no parent, always show it
const parentTasksCount = task.relatedTasks?.parenttask?.length ?? 0
if (parentTasksCount === 0) {