mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-01 20:13:04 +00:00
fix: stabilize virtualizer options to prevent measureElement ref changes that interrupt server actions
This commit is contained in:
parent
1b23bfba2b
commit
07329427bc
1 changed files with 9 additions and 6 deletions
|
|
@ -254,13 +254,16 @@ export const CampaignInfiniteTable = <Row,>({
|
||||||
|
|
||||||
const virtualizer = useVirtualizer({
|
const virtualizer = useVirtualizer({
|
||||||
count: itemCount,
|
count: itemCount,
|
||||||
estimateSize: () => ESTIMATED_ROW_HEIGHT,
|
estimateSize: useCallback(() => ESTIMATED_ROW_HEIGHT, []),
|
||||||
getScrollElement: () => scrollElement,
|
getScrollElement: useCallback(() => scrollElement, [scrollElement]),
|
||||||
overscan: 8,
|
overscan: 8,
|
||||||
getItemKey: (index) => {
|
getItemKey: useCallback(
|
||||||
const row = loadedRows[index]
|
(index: number) => {
|
||||||
return row ? rowKey(row) : `skeleton-${index}`
|
const row = loadedRows[index]
|
||||||
},
|
return row ? rowKey(row) : `skeleton-${index}`
|
||||||
|
},
|
||||||
|
[loadedRows, rowKey],
|
||||||
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
const virtualItems = virtualizer.getVirtualItems()
|
const virtualItems = virtualizer.getVirtualItems()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue