obsidian-tasks
obsidian-tasks copied to clipboard
perf: After file has been deleted, only update task blocks if deleted file contained any tasks
This was discovered whilst investigating #697.
Situation
As of Tasks 1.11.0, when a file is deleted, Cache.ts
:
- deletes all tasks from the named file
- forces all active tasks code blocks to be refreshed
The code - see line 148:
https://github.com/obsidian-tasks-group/obsidian-tasks/blob/ce5277ac00e231e6ea34bbe1de30ea9335e5c7b8/src/Cache.ts#L136:L152
Recommendation
An optimisation would be to do the this.notifySubscribers();
call if the number of tasks was changed.