Fix robot page exception on TypeError: Cannot read properties of undefined (reading 'cohort') (#2540)
* fix robot page exception on TypeError: Cannot read properties of undefined (reading 'cohort') in .filter * Update ChartConfigurationFlyout.tsx * Update ModelAssessmentDashboard.tsx
This commit is contained in:
Родитель
6898acd095
Коммит
1570b17bb8
|
@ -68,9 +68,9 @@ export class ChartConfigurationFlyout extends React.Component<
|
|||
// maximum which indicates that new cohorts were created.
|
||||
newCohorts = this.props.datasetCohorts
|
||||
.filter(
|
||||
(errorCohort) => errorCohort.cohort.getCohortID() > prevMaxCohortID
|
||||
(errorCohort) => errorCohort?.cohort?.getCohortID() > prevMaxCohortID
|
||||
)
|
||||
.map((errorCohort) => errorCohort.cohort.getCohortID());
|
||||
.map((errorCohort) => errorCohort?.cohort?.getCohortID());
|
||||
}
|
||||
|
||||
// reset feature-based cohort selection if the underlying feature-based cohorts changed
|
||||
|
|
|
@ -83,12 +83,12 @@ export class ModelOverviewChartPivot extends React.Component<
|
|||
// only keep selected stats and cohorts based on cohort ID
|
||||
labeledStatistics = this.props.labeledStatistics.filter((_, i) =>
|
||||
this.props.selectedChartCohorts.includes(
|
||||
chartCohorts[i].cohort.getCohortID()
|
||||
chartCohorts[i]?.cohort.getCohortID()
|
||||
)
|
||||
);
|
||||
chartCohorts = chartCohorts.filter((errorCohort) =>
|
||||
this.props.selectedChartCohorts.includes(
|
||||
errorCohort.cohort.getCohortID()
|
||||
errorCohort?.cohort.getCohortID()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -369,7 +369,7 @@ export class ModelAssessmentDashboard extends CohortBasedComponent<
|
|||
return;
|
||||
}
|
||||
const newCohorts = [...this.state.cohorts].filter(
|
||||
(t) => t.cohort.name !== cohort.cohort.name
|
||||
(t) => t?.cohort?.name !== cohort?.cohort?.name
|
||||
);
|
||||
this.setState({
|
||||
cohorts: newCohorts
|
||||
|
|
Загрузка…
Ссылка в новой задаче