Skip to content

Commit 17794eb

Browse files
committed
fix: keep a nested run from crashing the comparison table
The style set only defined nestedCv for a cross-validation session, but getRunType returns it for any run flagged nested. The strategy kind arrives asynchronously, so on the first render of a session with nested runs the key was missing and destructuring undefined took the whole table down. The style is now always defined and the legend does the filtering, with a fallback on the lookup so no row can crash the table over a style.
1 parent 93a1951 commit 17794eb

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

DashAI/front/src/components/models/ModelComparisonTable.jsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,20 @@ function ModelComparisonTable({
115115
color: theme.palette.accent.teal,
116116
label: "HPO",
117117
},
118-
...(isCrossValidation
119-
? {
120-
nestedCv: {
121-
bg: "#585370",
122-
border: "#585370",
123-
color: "#585370",
124-
label: "CV anidado",
125-
},
126-
}
127-
: {}),
118+
nestedCv: {
119+
bg: "#585370",
120+
border: "#585370",
121+
color: "#585370",
122+
label: "CV anidado",
123+
},
128124
};
129125

130-
const runTypeLegend = Object.entries(runTypeStyles).map(([key, value]) => ({
131-
key,
132-
...value,
133-
}));
126+
const runTypeLegend = Object.entries(runTypeStyles)
127+
.filter(([key]) => key !== "nestedCv" || isCrossValidation)
128+
.map(([key, value]) => ({
129+
key,
130+
...value,
131+
}));
134132

135133
const getMetricColumns = () => {
136134
const metricsSet = new Set();
@@ -442,7 +440,7 @@ function ModelComparisonTable({
442440
state: { columnOrder },
443441
muiTableBodyRowProps: ({ row }) => {
444442
const runType = getRunType(row.original);
445-
const { bg, border } = runTypeStyles[runType];
443+
const { bg, border } = runTypeStyles[runType] ?? runTypeStyles.withoutHpo;
446444
return {
447445
onClick: () => {
448446
if (onRowClick) onRowClick(row.original.id);

0 commit comments

Comments
 (0)