mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +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({
|
||||
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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue