From 46c46ff829ed601387048d5da99d156967226980 Mon Sep 17 00:00:00 2001 From: Steve Xu Date: Wed, 11 Dec 2024 23:25:46 +0800 Subject: [PATCH] [DataGrid] Fix "No rows" displaying when all rows are pinned (#15335) Signed-off-by: Steve Xu Co-authored-by: Kenan Yusuf --- .../src/hooks/features/overlays/useGridOverlays.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/x-data-grid/src/hooks/features/overlays/useGridOverlays.tsx b/packages/x-data-grid/src/hooks/features/overlays/useGridOverlays.tsx index 5fba040eab27..ba16aba36e2c 100644 --- a/packages/x-data-grid/src/hooks/features/overlays/useGridOverlays.tsx +++ b/packages/x-data-grid/src/hooks/features/overlays/useGridOverlays.tsx @@ -4,6 +4,7 @@ import { useGridApiContext } from '../../utils/useGridApiContext'; import { useGridRootProps } from '../../utils/useGridRootProps'; import { gridExpandedRowCountSelector } from '../filter'; import { gridRowCountSelector, gridRowsLoadingSelector } from '../rows'; +import { gridPinnedRowsCountSelector } from '../rows/gridRowsSelector'; import { GridLoadingOverlayVariant } from '../../../components/GridLoadingOverlay'; import { GridOverlayWrapper } from '../../../components/base/GridOverlays'; import type { GridOverlayType } from '../../../components/base/GridOverlays'; @@ -18,7 +19,8 @@ export const useGridOverlays = () => { const totalRowCount = useGridSelector(apiRef, gridRowCountSelector); const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector); - const noRows = totalRowCount === 0; + const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector); + const noRows = totalRowCount === 0 && pinnedRowsCount === 0; const loading = useGridSelector(apiRef, gridRowsLoadingSelector); const showNoRowsOverlay = !loading && noRows;