MCPcopy
hub / github.com/callumalpass/tasknotes / initializeSubtasks

Method initializeSubtasks

src/modals/TaskEditModal.ts:716–741  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

714 }
715
716 protected async initializeSubtasks(): Promise<void> {
717 try {
718 const taskFile = this.app.vault.getAbstractFileByPath(this.task.path);
719 if (!(taskFile instanceof TFile)) return;
720
721 const subtasks =
722 await this.plugin.projectSubtasksService.getTasksLinkedToProject(taskFile);
723 const sortedSubtasks = this.plugin.projectSubtasksService.sortTasks([...subtasks]);
724 this.selectedSubtaskFiles = [];
725 this.initialSubtaskFiles = [];
726
727 for (const subtask of sortedSubtasks) {
728 const subtaskFile = this.app.vault.getAbstractFileByPath(subtask.path);
729 if (subtaskFile) {
730 this.selectedSubtaskFiles.push(subtaskFile);
731 this.initialSubtaskFiles.push(subtaskFile);
732 }
733 }
734 } catch (error) {
735 tasknotesLogger.error("Error initializing subtasks:", {
736 category: "persistence",
737 operation: "initializing-subtasks",
738 error: error,
739 });
740 }
741 }
742
743 protected hasSubtaskChanges(): boolean {
744 return hasTaskEditSubtaskChanges(this.initialSubtaskFiles, this.selectedSubtaskFiles);

Calls 4

getAbstractFileByPathMethod · 0.80
errorMethod · 0.80
sortTasksMethod · 0.45

Tested by

no test coverage detected