obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

perf: After file has been deleted, only update task blocks if deleted file contained any tasks

Open claremacrae opened this issue 2 years ago • 0 comments

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.

claremacrae avatar Jul 29 '22 08:07 claremacrae