From 33b04590787661d95e0dc24e32909eddfcbd0d86 Mon Sep 17 00:00:00 2001 From: Armin Mehinovic Date: Fri, 16 Aug 2024 16:29:44 +0200 Subject: [PATCH] Import throttle from internals package. Do not reset rendering context when sorting model is updated --- .../serverSideLazyLoader/useGridDataSourceLazyLoader.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.ts b/packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.ts index 804158271babb..72c302f421208 100644 --- a/packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.ts +++ b/packages/x-data-grid-pro/src/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.ts @@ -1,4 +1,5 @@ import * as React from 'react'; +import { throttle } from '@mui/x-internals/throttle'; import { useGridApiEventHandler, useGridSelector, @@ -14,7 +15,6 @@ import { getVisibleRows, GridGetRowsParams, gridRenderContextSelector, - throttle, } from '@mui/x-data-grid/internals'; import { GridPrivateApiPro } from '../../../models/gridApiPro'; import { DataGridProProcessedProps } from '../../../models/dataGridProProps'; @@ -143,7 +143,7 @@ export const useGridDataSourceLazyLoader = ( ); const throttledHandleRenderedRowsIntervalChange = React.useMemo( - () => throttle(handleRenderedRowsIntervalChange, 300), // TODO: make it configurable + () => throttle(handleRenderedRowsIntervalChange, 500), // TODO: make it configurable [handleRenderedRowsIntervalChange], ); @@ -158,8 +158,6 @@ export const useGridDataSourceLazyLoader = ( privateApiRef.current.setRows([]); addSkeletonRows(); - renderedRowsIntervalCache.current = INTERVAL_CACHE_INITIAL_STATE; - const getRowsParams: GridGetRowsParams = { start: renderContext.firstRowIndex, end: renderContext.lastRowIndex,