Skip to content

Commit

Permalink
Fix virtualization options for pagination mode
Browse files Browse the repository at this point in the history
  • Loading branch information
achyutjhunjhunwala committed Mar 3, 2025
1 parent 0f3277f commit 3855658
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1165,19 +1165,22 @@ export const UnifiedDataTable = ({
const { run: throttledHandleItemsRendered } = useThrottleFn(handleItemsRendered, { wait: 500 });

const virtualizationOptions = useMemo(() => {
// Don't use row overscan when showing Document column since
const options = {
onItemsRendered:
paginationMode === DEFAULT_PAGINATION_MODE ? undefined : throttledHandleItemsRendered,
};

// Don't use row "overscan" when showing Document/Summary column since
// rendering so much DOM content in each cell impacts performance
if (defaultColumns) {
return {
onItemsRendered: throttledHandleItemsRendered,
};
return options;
}

return {
...VIRTUALIZATION_OPTIONS,
onItemsRendered: throttledHandleItemsRendered,
...options,
};
}, [defaultColumns, throttledHandleItemsRendered]);
}, [defaultColumns, paginationMode, throttledHandleItemsRendered]);

const isRenderComplete = loadingState !== DataLoadingState.loading;

Expand Down

0 comments on commit 3855658

Please sign in to comment.