diff --git a/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx b/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx index 3a89a3254b60a..ee5325a7ad5b4 100644 --- a/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx +++ b/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx @@ -368,7 +368,7 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => { return null; } - const { renderedColumns, firstColumnToRender, lastColumnToRender } = columnsToRender; + const { firstColumnToRender, lastColumnToRender } = columnsToRender; const rowStructure = columnGroupsHeaderStructure[depth]; @@ -464,7 +464,7 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => { pinnedPosition={pinnedPosition} style={style} indexInSection={indexInSection} - sectionLength={renderedColumns.length} + sectionLength={rowStructure.length} gridHasFiller={gridHasFiller} /> );