From 112fb2cf023c41555f8e7fe68c440322e610ebc5 Mon Sep 17 00:00:00 2001 From: Armin Mehinovic Date: Thu, 9 Jan 2025 13:34:22 +0100 Subject: [PATCH] Performance improvement --- .../useGridDataSourceLazyLoader.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 8f08a1f624fce..128b5c05a4110 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 @@ -318,12 +318,12 @@ export const useGridDataSourceLazyLoader = ( const handleScrolling: GridEventListener<'scrollPositionChange'> = React.useCallback( (newScrollPosition) => { + if (rowsStale.current || loadingTrigger.current !== LoadingTrigger.SCROLL_END) { + return; + } + const renderContext = gridRenderContextSelector(privateApiRef); - if ( - rowsStale.current || - loadingTrigger.current !== LoadingTrigger.SCROLL_END || - previousLastRowIndex.current >= renderContext.lastRowIndex - ) { + if (previousLastRowIndex.current >= renderContext.lastRowIndex) { return; }