Skip to content

Commit

Permalink
fix(VirtualizedGrid): fix onItemsRendered params (#2674)
Browse files Browse the repository at this point in the history
  • Loading branch information
talkor authored Dec 24, 2024
1 parent e0438a4 commit 48d4711
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/core/src/components/VirtualizedGrid/VirtualizedGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React, { CSSProperties, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
import cx from "classnames";
import { GridChildComponentProps, GridOnScrollProps, ScrollDirection, VariableSizeGrid as Grid } from "react-window";
import {
GridChildComponentProps,
GridOnScrollProps,
ScrollDirection,
VariableSizeGrid as Grid,
GridOnItemsRenderedProps
} from "react-window";
import AutoSizer from "react-virtualized-auto-sizer";
import {
getNormalizedItems,
Expand Down Expand Up @@ -209,14 +215,14 @@ const VirtualizedGrid: VibeComponent<VirtualizedGridProps> = forwardRef(
);

const onItemsRenderedCB = useThrottledCallback(
({ visibleStartIndex, visibleStopIndex }) => {
({ visibleRowStartIndex, visibleRowStopIndex }: GridOnItemsRenderedProps) => {
if (!onItemsRendered) return;
const data = getOnItemsRenderedData(
items,
normalizedItems,
idGetter,
visibleStartIndex,
visibleStopIndex,
visibleRowStartIndex,
visibleRowStopIndex,
gridHeight,
scrollTopRef.current
);
Expand Down

0 comments on commit 48d4711

Please sign in to comment.