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

Method toggleSubtasks

src/bases/TaskListView.ts:2769–2804  ·  view source on GitHub ↗
(task: TaskInfo, target: HTMLElement)

Source from the content-addressed store, hash-verified

2767 }
2768
2769 private async toggleSubtasks(task: TaskInfo, target: HTMLElement): Promise<void> {
2770 try {
2771 if (!this.plugin.expandedProjectsService) {
2772 tasknotesLogger.error(
2773 "[TaskNotes][TaskListView] ExpandedProjectsService not initialized",
2774 { category: "stale-data", operation: "expandedprojectsservice-not-initialized" }
2775 );
2776 new Notice("Service not available. Please try reloading the plugin.");
2777 return;
2778 }
2779
2780 const newExpanded = this.plugin.expandedProjectsService.toggle(
2781 task.path,
2782 this.plugin.settings?.expandSubtasksByDefault === true
2783 );
2784 target.classList.toggle("task-card__chevron--expanded", newExpanded);
2785 target.setAttribute(
2786 "aria-label",
2787 newExpanded ? "Collapse subtasks" : "Expand subtasks"
2788 );
2789
2790 // Find the card element and toggle subtasks display
2791 const card = target.closest<HTMLElement>(".task-card");
2792 if (card) {
2793 const { toggleSubtasks } = await import("../ui/TaskCard");
2794 await toggleSubtasks(card, task, this.plugin, newExpanded);
2795 }
2796 } catch (error) {
2797 tasknotesLogger.error("[TaskNotes][TaskListView] Failed to toggle subtasks", {
2798 category: "persistence",
2799 operation: "toggle-subtasks",
2800 error: error,
2801 });
2802 new Notice("Failed to toggle subtasks");
2803 }
2804 }
2805
2806 private async toggleBlockingTasks(task: TaskInfo, target: HTMLElement): Promise<void> {
2807 try {

Callers 1

handleActionClickMethod · 0.95

Calls 3

toggleSubtasksFunction · 0.85
errorMethod · 0.80
toggleMethod · 0.80

Tested by

no test coverage detected