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

Method handleTaskUpdate

src/bases/TaskListView.ts:1985–2022  ·  view source on GitHub ↗
(task: TaskInfo)

Source from the content-addressed store, hash-verified

1983 }
1984
1985 protected async handleTaskUpdate(task: TaskInfo): Promise<void> {
1986 // Update cache
1987 this.taskInfoCache.set(task.path, task);
1988 this.lastTaskSignatures.set(task.path, this.buildTaskSignature(task));
1989
1990 // For virtual scrolling, just do a full refresh
1991 // Simple and reliable, performance is still good with virtual scrolling
1992 if (this.useVirtualScrolling) {
1993 this.debouncedRefresh();
1994 } else {
1995 // Normal mode - update the specific card
1996 const existingElement = this.currentTaskElements.get(task.path);
1997 if (existingElement && existingElement.isConnected) {
1998 const visibleProperties = this.getVisibleProperties();
1999 const replacement = createTaskCard(
2000 task,
2001 this.plugin,
2002 visibleProperties,
2003 this.getCardOptions(this.currentTargetDate)
2004 );
2005 this.configureCardForManualReordering(
2006 replacement,
2007 task,
2008 this.taskGroupKeys.get(task.path) ?? null
2009 );
2010 existingElement.replaceWith(replacement);
2011 replacement.classList.add("task-card--updated");
2012 // Use correct window for pop-out window support
2013 const win = this.containerEl.ownerDocument.defaultView || window;
2014 win.setTimeout(() => {
2015 replacement.classList.remove("task-card--updated");
2016 }, 1000);
2017 this.currentTaskElements.set(task.path, replacement);
2018 } else {
2019 this.debouncedRefresh();
2020 }
2021 }
2022 }
2023
2024 private renderEmptyState(): void {
2025 // Use correct document for pop-out window support

Callers

nothing calls this directly

Calls 8

buildTaskSignatureMethod · 0.95
getCardOptionsMethod · 0.95
createTaskCardFunction · 0.90
setMethod · 0.65
getMethod · 0.65
setTimeoutMethod · 0.65
debouncedRefreshMethod · 0.45

Tested by

no test coverage detected