Skip to content

Commit 4ef0b1a

Browse files
committed
fix: re-render report table
1 parent 620904b commit 4ef0b1a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

apps/start/src/components/report-chart/common/report-table.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,10 @@ export function ReportTable({
676676
},
677677
cell: ({ row }) => {
678678
const original = row.original;
679-
const serieName = original.serieName;
680679
const serieId = original.serieId;
680+
// Look up serie name directly from data to ensure we always have the latest value
681+
const serie = data.series.find((s) => s.id === serieId);
682+
const serieName = serie?.names[0] ?? original.serieName ?? '';
681683
const isVisible = visibleSeriesIds.includes(serieId);
682684
const serieIndex = getSerieIndex(serieId);
683685
const color = getChartColor(serieIndex);
@@ -1043,6 +1045,7 @@ export function ReportTable({
10431045
dateRanges,
10441046
columnSizing,
10451047
expanded,
1048+
data,
10461049
]);
10471050

10481051
// Create a hash of column IDs to track when columns change
@@ -1624,9 +1627,15 @@ export function ReportTable({
16241627
const tableRow = rowModelToUse.rows[virtualRow.index];
16251628
if (!tableRow) return null;
16261629

1630+
// Include serie name in key to force re-render when name changes
1631+
const serieId = tableRow.original.serieId;
1632+
const serie = data.series.find((s) => s.id === serieId);
1633+
const serieName =
1634+
serie?.names[0] ?? tableRow.original.serieName ?? '';
1635+
16271636
return (
16281637
<VirtualRow
1629-
key={`${virtualRow.key}-${gridTemplateColumns}`}
1638+
key={`${virtualRow.key}-${serieName}-${gridTemplateColumns}`}
16301639
row={tableRow}
16311640
virtualRow={{
16321641
...virtualRow,

0 commit comments

Comments
 (0)