diff --git a/src/components/campaign/shared/CampaignInfiniteTable.tsx b/src/components/campaign/shared/CampaignInfiniteTable.tsx index 26ef138a..e739bb09 100644 --- a/src/components/campaign/shared/CampaignInfiniteTable.tsx +++ b/src/components/campaign/shared/CampaignInfiniteTable.tsx @@ -254,13 +254,16 @@ export const CampaignInfiniteTable = ({ const virtualizer = useVirtualizer({ count: itemCount, - estimateSize: () => ESTIMATED_ROW_HEIGHT, - getScrollElement: () => scrollElement, + estimateSize: useCallback(() => ESTIMATED_ROW_HEIGHT, []), + getScrollElement: useCallback(() => scrollElement, [scrollElement]), overscan: 8, - getItemKey: (index) => { - const row = loadedRows[index] - return row ? rowKey(row) : `skeleton-${index}` - }, + getItemKey: useCallback( + (index: number) => { + const row = loadedRows[index] + return row ? rowKey(row) : `skeleton-${index}` + }, + [loadedRows, rowKey], + ), }) const virtualItems = virtualizer.getVirtualItems()