* Re-render currently visible items by key without rebuilding the whole scroller.
(keys: readonly string[], options: VirtualScrollerInvalidateOptions = {})
| 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 |
no test coverage detected