mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
This commit is contained in:
parent
108820695e
commit
8003a9e125
2 changed files with 9 additions and 1 deletions
|
|
@ -32,6 +32,12 @@ describe('isBlankTask', () => {
|
|||
expect(isBlankTask(createTaskWithSubTasks())).toBe(true);
|
||||
});
|
||||
|
||||
it('should be true (and not throw) when the title is missing entirely', () => {
|
||||
const t = createTaskWithSubTasks() as any;
|
||||
delete t.title;
|
||||
expect(isBlankTask(t)).toBe(true);
|
||||
});
|
||||
|
||||
it('should be true when the title is only whitespace', () => {
|
||||
expect(isBlankTask(createTaskWithSubTasks({ title: ' ' }))).toBe(true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ import { Task, TaskWithSubTasks } from '../task.model';
|
|||
export const isBlankTask = (task: Task | TaskWithSubTasks): boolean => {
|
||||
const subTasks = (task as TaskWithSubTasks).subTasks;
|
||||
return (
|
||||
!task.title.trim() &&
|
||||
// Corrupted/legacy tasks can lack a title entirely; treat that as blank
|
||||
// instead of crashing the callers (e.g. the delete-undo snack effect).
|
||||
!task.title?.trim() &&
|
||||
!task.notes?.trim() &&
|
||||
!task.timeSpent &&
|
||||
!task.timeEstimate &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue