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

Method refreshGroupedView

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

Source from the content-addressed store, hash-verified

2387 }
2388
2389 private async refreshGroupedView(): Promise<void> {
2390 if (!this.data?.data) return;
2391
2392 const dataItems = this.dataAdapter.extractDataItems();
2393 computeBasesFormulas(this.data, dataItems);
2394 const taskNotes = await identifyTaskNotesFromBasesData(dataItems, this.plugin);
2395 const filteredTasks = this.applySearchFilter(taskNotes);
2396 this.setExpandedRelationshipTaskScope(filteredTasks);
2397 const renderTasks = this.getTopLevelRenderTasks(filteredTasks);
2398 this.setCurrentVisibleTaskPaths(renderTasks);
2399
2400 const pathToProps = this.subGroupPropertyId
2401 ? buildTaskListPathProperties(dataItems)
2402 : new Map<string, Record<string, unknown>>();
2403 let items: TaskListRenderItem[];
2404
2405 if (!this.dataAdapter.isGrouped() && this.subGroupPropertyId) {
2406 const groupedTasks = groupTasksByTaskListSubProperty(
2407 renderTasks,
2408 this.subGroupPropertyId,
2409 pathToProps
2410 );
2411 this.applyGroupingSnapshot(this.createSubPropertyHierarchySnapshot(groupedTasks));
2412 items = buildTaskListSubPropertyRenderItems(groupedTasks, this.collapsedGroups);
2413 } else {
2414 const groups = this.dataAdapter.getGroupedData() as TaskListGroup[];
2415 this.applyGroupingSnapshot(this.createGroupedHierarchySnapshot(groups, renderTasks));
2416 items = buildTaskListGroupedRenderItems({
2417 groups,
2418 taskNotes: renderTasks,
2419 subGroupPropertyId: this.subGroupPropertyId,
2420 pathToProps,
2421 collapsedGroups: this.collapsedGroups,
2422 collapsedSubGroups: this.collapsedSubGroups,
2423 convertGroupKeyToString: (key) =>
2424 this.dataAdapter.convertGroupKeyToString(key),
2425 });
2426 }
2427
2428 // Update virtual scroller with new items
2429 if (this.useVirtualScrolling && this.virtualScroller) {
2430 this.syncGroupedDragMetadata(items);
2431 this.virtualScroller.updateItems(items);
2432 } else {
2433 // If not using virtual scrolling, do full render
2434 await this.render();
2435 }
2436 }
2437
2438 private handleItemContextMenu = async (event: MouseEvent) => {
2439 const context = this.getTaskContextFromEvent(event);

Tested by

no test coverage detected