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

Function updateTaskElementInPlace

src/utils/viewOptimizations.ts:201–227  ·  view source on GitHub ↗

* Update a task element in place using TaskCard functionality

(
	element: HTMLElement,
	taskInfo: TaskInfo,
	plugin: TaskNotesPlugin,
	visibleProperties: string[],
	propertyLabels?: Record<string, string>
)

Source from the content-addressed store, hash-verified

199 * Update a task element in place using TaskCard functionality
200 */
201async function updateTaskElementInPlace(
202 element: HTMLElement,
203 taskInfo: TaskInfo,
204 plugin: TaskNotesPlugin,
205 visibleProperties: string[],
206 propertyLabels?: Record<string, string>
207): Promise<void> {
208 try {
209 // Use the existing updateTaskCard function if available
210 const { updateTaskCard } = await import("../ui/TaskCard");
211
212 updateTaskCard(element, taskInfo, plugin, visibleProperties, { propertyLabels });
213
214 // Add update animation
215 element.classList.add("task-card--updated");
216 window.setTimeout(() => {
217 element.classList.remove("task-card--updated");
218 }, 1000);
219 } catch (error) {
220 tasknotesLogger.error("[ViewOptimizations] Error updating task element in place:", {
221 category: "persistence",
222 operation: "updating-task-element-place",
223 error: error,
224 });
225 // Could fallback to full refresh here if needed
226 }
227}
228
229/**
230 * Performance monitoring utility for debugging

Callers 1

Calls 3

updateTaskCardFunction · 0.85
errorMethod · 0.80
setTimeoutMethod · 0.65

Tested by

no test coverage detected