mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-21 02:20:12 +00:00
fix(tasks): filter undefined entities in selectAllTasks to prevent crashes
This commit is contained in:
parent
ef480810a9
commit
5e0453203c
1 changed files with 11 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue