From 5e0453203c19d036c00527a06c0d0bff06e5b52d Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Mon, 2 Feb 2026 18:23:57 +0100 Subject: [PATCH] fix(tasks): filter undefined entities in selectAllTasks to prevent crashes --- src/app/features/tasks/store/task.selectors.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/features/tasks/store/task.selectors.ts b/src/app/features/tasks/store/task.selectors.ts index 8039856003..084b6d3d24 100644 --- a/src/app/features/tasks/store/task.selectors.ts +++ b/src/app/features/tasks/store/task.selectors.ts @@ -274,7 +274,17 @@ export const selectCurrentTaskParentOrCurrent = createSelector( }, ); -export const selectAllTasks = createSelector(selectTaskFeatureState, selectAll); +export const selectAllTasks = createSelector( + selectTaskFeatureState, + (state: TaskState): Task[] => { + const all = selectAll(state); + const filtered = all.filter((task): task is Task => !!task); + if (filtered.length !== all.length) { + devError('selectAllTasks: found undefined entities in task state'); + } + return filtered; + }, +); export const selectAllTasksWithSubTasks = createSelector( selectAllTasks,