Skip to content

Commit

Permalink
dedupe headerRowsHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
nstepien committed Aug 22, 2023
1 parent e54fcbe commit 77bf8df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ function DataGrid<R, SR, K extends Key>(
*/
const isTreeGrid = role === 'treegrid';
const [gridRef, gridWidth, gridHeight] = useGridDimensions();
const clientHeight =
gridHeight - headerRowsCount * headerRowHeight - summaryRowsCount * summaryRowHeight;
const headerRowsHeight = headerRowsCount * headerRowHeight;
const clientHeight = gridHeight - headerRowsHeight - summaryRowsCount * summaryRowHeight;
const isSelectable = selectedRows != null && onSelectedRowsChange != null;
const isRtl = direction === 'rtl';
const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
Expand Down Expand Up @@ -1008,7 +1008,7 @@ function DataGrid<R, SR, K extends Key>(
scrollPaddingBlock:
isRowIdxWithinViewportBounds(selectedPosition.rowIdx) ||
scrollToPosition?.rowIdx !== undefined
? `${headerRowsCount * headerRowHeight + topSummaryRowsCount * summaryRowHeight}px ${
? `${headerRowsHeight + topSummaryRowsCount * summaryRowHeight}px ${
bottomSummaryRowsCount * summaryRowHeight
}px`
: undefined,
Expand Down Expand Up @@ -1064,7 +1064,7 @@ function DataGrid<R, SR, K extends Key>(
const gridRowStart = headerRowsCount + 1 + rowIdx;
const summaryRowIdx = mainHeaderIndex + 1 + rowIdx;
const isSummaryRowSelected = selectedPosition.rowIdx === summaryRowIdx;
const top = headerRowsCount * headerRowHeight + summaryRowHeight * rowIdx;
const top = headerRowsHeight + summaryRowHeight * rowIdx;

return (
<SummaryRow
Expand Down

0 comments on commit 77bf8df

Please sign in to comment.