From ca99f8891f44da35535b4133abb0f90e64dccb6f Mon Sep 17 00:00:00 2001 From: hatim dinia Date: Wed, 4 Dec 2024 10:52:25 +0100 Subject: [PATCH] fix(ui-bc): use `matrixindex` timesteps for row display --- webapp/src/components/common/Matrix/hooks/useMatrix/index.ts | 4 ++++ webapp/src/components/common/Matrix/index.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) 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}