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

Method invalidateItems

src/utils/VirtualScroller.ts:798–821  ·  view source on GitHub ↗

* Re-render currently visible items by key without rebuilding the whole scroller.

(keys: readonly string[], options: VirtualScrollerInvalidateOptions = {})

Source from the content-addressed store, hash-verified

796 * Re-render currently visible items by key without rebuilding the whole scroller.
797 */
798 invalidateItems(keys: readonly string[], options: VirtualScrollerInvalidateOptions = {}): void {
799 if (keys.length === 0) {
800 return;
801 }
802
803 const keySet = new Set(keys);
804 if (options.invalidateHeights) {
805 for (const key of keySet) {
806 const element = this.renderedElements.get(key);
807 if (!element) continue;
808
809 const index = parseInt(element.dataset.virtualIndex || "-1", 10);
810 if (index >= 0) {
811 this.itemHeights.delete(index);
812 }
813 }
814 this.rebuildPositionCache();
815 }
816
817 for (const key of keySet) {
818 this.invalidatedKeys.add(key);
819 }
820 this.forceVisibleRangeUpdate();
821 }
822
823 /**
824 * Scroll to a specific item index

Calls 4

rebuildPositionCacheMethod · 0.95
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected