Skip to content

Commit 9c61e54

Browse files
committed
Fix infinite loader.
1 parent 223b426 commit 9c61e54

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/tableV2/core/rows.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const Rows = ({
3030
})
3131

3232
const virtualRows = virtualizer.getVirtualItems()
33-
const totalSize = virtualizer.getTotalSize()
3433

3534
useEffect(() => {
3635
if (!loadMore) return
@@ -39,12 +38,14 @@ const Rows = ({
3938

4039
if (!lastItem) return
4140

42-
if (lastItem.index >= totalSize - 1 && hasNextPage && !loading) loadMore()
43-
}, [hasNextPage, virtualRows, loadMore])
41+
if (lastItem.index >= rows.length - 1 && hasNextPage && !loading) loadMore()
42+
}, [virtualRows])
4443

4544
const paddingTop = virtualRows.length > 0 ? virtualRows?.[0]?.start || 0 : 0
45+
46+
const totalHeight = virtualizer.getTotalSize()
4647
const paddingBottom =
47-
virtualRows.length > 0 ? totalSize - (virtualRows?.[virtualRows.length - 1]?.end || 0) : 0
48+
virtualRows.length > 0 ? totalHeight - (virtualRows?.[virtualRows.length - 1]?.end || 0) : 0
4849

4950
const handleOnMouseEnter = id => {
5051
onHoverRow?.(id)

src/components/tableV2/features/useBulkActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default ({ bulkActions, enableColumnVisibility, ...props }) => {
4747

4848
return useMemo(() => {
4949
if (!bulkActions) return columnVisibilityAction
50-
console.log(1)
50+
5151
return Object.keys(bulkActions)
5252
.map(actionKey => {
5353
const supportedBulkAction = supportedBulkActions[actionKey] || supportedBulkActions.delete

0 commit comments

Comments
 (0)