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

Method renderFlat

src/bases/TaskListView.ts:1465–1512  ·  view source on GitHub ↗
(taskNotes: TaskInfo[])

Source from the content-addressed store, hash-verified

1463 }
1464
1465 private async renderFlat(taskNotes: TaskInfo[]): Promise<void> {
1466 const visibleProperties = this.getVisibleProperties();
1467 this.setSortScopeCandidatePaths([[null, taskNotes.map((task) => task.path)]]);
1468
1469 // Apply search filter
1470 const filteredTasks = this.applySearchFilter(taskNotes);
1471 this.setExpandedRelationshipTaskScope(filteredTasks);
1472 const renderTasks = this.getTopLevelRenderTasks(filteredTasks);
1473 this.setCurrentVisibleTaskPaths(renderTasks);
1474
1475 // Show "no results" if search returned empty but we had tasks
1476 if (this.isSearchWithNoResults(filteredTasks, taskNotes.length)) {
1477 this.clearAllTaskElements();
1478 this.sortScopeTaskPaths.clear();
1479 this.sortScopeCandidateTaskPaths.clear();
1480 if (this.itemsContainer) {
1481 this.renderSearchNoResults(this.itemsContainer);
1482 }
1483 return;
1484 }
1485
1486 // Note: taskNotes are already sorted by Bases according to sort configuration
1487 // No manual sorting needed - Bases provides pre-sorted data
1488
1489 const targetDate = createUTCDateFromLocalCalendarDate(new Date());
1490 this.currentTargetDate = targetDate;
1491
1492 const cardOptions = this.getCardOptions(targetDate);
1493
1494 // Decide whether to use virtual scrolling based on filtered task count
1495 const shouldUseVirtualScrolling = renderTasks.length >= this.VIRTUAL_SCROLL_THRESHOLD;
1496
1497 if (shouldUseVirtualScrolling && !this.useVirtualScrolling) {
1498 // Switch to virtual scrolling
1499 this.cleanupNonVirtualRendering();
1500 this.useVirtualScrolling = true;
1501 } else if (!shouldUseVirtualScrolling && this.useVirtualScrolling) {
1502 // Switch back to normal rendering
1503 this.destroyVirtualScroller();
1504 this.useVirtualScrolling = false;
1505 }
1506
1507 if (this.useVirtualScrolling) {
1508 await this.renderFlatVirtual(renderTasks, visibleProperties, cardOptions);
1509 } else {
1510 await this.renderFlatNormal(renderTasks, visibleProperties, cardOptions);
1511 }
1512 }
1513
1514 private async renderFlatVirtual(
1515 taskNotes: TaskInfo[],

Callers 1

renderMethod · 0.95

Calls 12

clearAllTaskElementsMethod · 0.95
getCardOptionsMethod · 0.95
renderFlatVirtualMethod · 0.95
renderFlatNormalMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected