diff --git a/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts b/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts index 286b732405..6558e764e8 100644 --- a/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts +++ b/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts @@ -320,5 +320,9 @@ export function useMatrix( canUndo: canUndoChanges, canRedo, reload: fetchMatrix, + // Use the matrix index 'steps' field to determine the number of rows + // This ensures consistent row display (8760 for hourly, 365 for daily/weekly) + // rather than using data.length which can vary for Binding Constraints (8784/366) + rowCount: index?.steps, }; } diff --git a/webapp/src/components/common/Matrix/index.tsx b/webapp/src/components/common/Matrix/index.tsx index 1316d2d7f2..4bb07202dd 100644 --- a/webapp/src/components/common/Matrix/index.tsx +++ b/webapp/src/components/common/Matrix/index.tsx @@ -83,6 +83,7 @@ function Matrix({ canUndo, canRedo, reload, + rowCount, } = useMatrix( study.id, url, @@ -136,7 +137,7 @@ function Matrix({ data={data} aggregates={aggregates} columns={columns} - rows={data.length} + rows={rowCount ?? data.length} rowHeaders={customRowHeaders} dateTime={dateTime} onCellEdit={handleCellEdit}