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

Method render

src/bases/TaskListView.ts:501–583  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

499 }
500
501 async render(): Promise<void> {
502 if (!this.itemsContainer || !this.rootElement) return;
503
504 // Defer re-render while a drag is in progress — re-rendering
505 // destroys card elements and their event listeners, which
506 // causes the drop event to never fire.
507 if (this.draggedTaskPath) {
508 this.pendingRender = true;
509 return;
510 }
511
512 // Always re-read view options to catch config changes such as
513 // switching expanded relationship filtering modes in Bases.
514 if (this.config) {
515 this.readViewOptions();
516 }
517
518 // Now that config is loaded, setup search (idempotent: will only create once)
519 if (this.rootElement) {
520 this.setupSearch(this.rootElement);
521 }
522 try {
523 // Skip rendering if we have no data yet (prevents flickering during data updates)
524 if (!this.data?.data) {
525 this.clearGroupingSnapshot();
526 return;
527 }
528
529 // Extract data using adapter (adapter now uses this as basesView)
530 const dataItems = this.dataAdapter.extractDataItems();
531
532 // Compute Bases formulas for TaskNotes items
533 computeBasesFormulas(this.data, dataItems);
534
535 const taskNotes = await identifyTaskNotesFromBasesData(dataItems, this.plugin);
536
537 if (taskNotes.length === 0) {
538 this.clearAllTaskElements();
539 this.sortScopeTaskPaths.clear();
540 this.sortScopeCandidateTaskPaths.clear();
541 this.clearGroupingSnapshot();
542 this.renderEmptyState();
543 this.lastRenderWasGrouped = false;
544 return;
545 }
546
547 const isGrouped = this.dataAdapter.isGrouped();
548
549 // Special case: if sub-grouping is configured but primary grouping is not,
550 // treat sub-group property as primary grouping
551 if (!isGrouped && this.subGroupPropertyId) {
552 if (!this.lastRenderWasGrouped) {
553 this.clearAllTaskElements();
554 }
555 await this.renderGroupedBySubProperty(taskNotes);
556 this.lastRenderWasGrouped = true;
557 } else if (isGrouped) {
558 if (!this.lastRenderWasGrouped) {

Callers 1

refreshGroupedViewMethod · 0.95

Calls 14

readViewOptionsMethod · 0.95
clearGroupingSnapshotMethod · 0.95
clearAllTaskElementsMethod · 0.95
renderEmptyStateMethod · 0.95
renderGroupedMethod · 0.95
renderFlatMethod · 0.95
renderErrorMethod · 0.95
computeBasesFormulasFunction · 0.90
extractDataItemsMethod · 0.80
isGroupedMethod · 0.80

Tested by

no test coverage detected