Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix robot page exception on TypeError: Cannot read properties of undefined (reading 'cohort') #2540

Merged
merged 4 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading