Skip to content

Commit

Permalink
[DataGrid] Fix "No rows" displaying when all rows are pinned (mui#15335)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Xu <[email protected]>
Co-authored-by: Kenan Yusuf <[email protected]>
  • Loading branch information
nusr and KenanYusuf authored Dec 11, 2024
1 parent e7a9530 commit 46c46ff
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down

0 comments on commit 46c46ff

Please sign in to comment.