MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / onOpen

Method onOpen

src/views/StatsView.ts:216–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214 }
215
216 async onOpen() {
217 await this.plugin.onReady();
218 this.currentFilters = this.loadPersistedFilters();
219
220 // Listen for task updates to refresh the drill-down modal if it's open
221 const taskUpdateListener = this.plugin.emitter.on(
222 EVENT_TASK_UPDATED,
223 async ({ path, originalTask, updatedTask }) => {
224 if (!path || !updatedTask || !this.drilldownModal || !this.currentDrilldownData)
225 return;
226
227 // Check if the updated task is part of the current drill-down data
228 const taskExists = this.currentDrilldownData.tasks.some(
229 (task) =>
230 task.path === path || (originalTask && task.path === originalTask.path)
231 );
232
233 if (taskExists) {
234 // Refresh the drill-down modal with updated task data
235 await this.refreshDrilldownModal();
236 }
237 }
238 );
239 this.listeners.push(taskUpdateListener);
240
241 await this.render();
242 }
243
244 async onClose() {
245 this.contentEl.empty();

Callers

nothing calls this directly

Calls 5

loadPersistedFiltersMethod · 0.95
refreshDrilldownModalMethod · 0.95
renderMethod · 0.95
onReadyMethod · 0.80
onMethod · 0.65

Tested by

no test coverage detected