From 1ae89cc2adb411470ff25e97711998df6e308124 Mon Sep 17 00:00:00 2001 From: Roman Zino Date: Thu, 28 Nov 2024 08:12:25 +0200 Subject: [PATCH] [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15622) --- .../src/hooks/features/dataSource/useGridDataSource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/x-data-grid-pro/src/hooks/features/dataSource/useGridDataSource.ts b/packages/x-data-grid-pro/src/hooks/features/dataSource/useGridDataSource.ts index 31f3d209a695b..92b19b032d030 100644 --- a/packages/x-data-grid-pro/src/hooks/features/dataSource/useGridDataSource.ts +++ b/packages/x-data-grid-pro/src/hooks/features/dataSource/useGridDataSource.ts @@ -95,7 +95,7 @@ export const useGridDataSource = ( if (cachedData !== undefined) { const rows = cachedData.rows; apiRef.current.setRows(rows); - if (cachedData.rowCount) { + if (cachedData.rowCount !== undefined) { apiRef.current.setRowCount(cachedData.rowCount); } return; @@ -109,7 +109,7 @@ export const useGridDataSource = ( try { const getRowsResponse = await getRows(fetchParams); apiRef.current.unstable_dataSource.cache.set(fetchParams, getRowsResponse); - if (getRowsResponse.rowCount) { + if (getRowsResponse.rowCount !== undefined) { apiRef.current.setRowCount(getRowsResponse.rowCount); } apiRef.current.setRows(getRowsResponse.rows);