Skip to content

Commit

Permalink
fix remove chart errors
Browse files Browse the repository at this point in the history
  • Loading branch information
qlu-cls committed Jun 17, 2024
1 parent f2ebca1 commit 83c1eb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 14 additions & 10 deletions src/pages/groupComparison/Survival.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
);
}

@action.bound
private onDeleteSurvivalPlot(prefix: string) {
this.setSurvivalPlotPrefix(undefined);
this.props.store.removeCustomSurvivalPlot(prefix);
}

@computed get selectedCensoredClinicalEventType() {
if (this._selectedCensoredClinicalEventType !== undefined) {
if (this._selectedCensoredClinicalEventType === 'any') {
Expand Down Expand Up @@ -980,9 +986,7 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
}
setSelectedPrefix={this.setSurvivalPlotPrefix}
dataStore={this.survivalPrefixTableDataStore.result!}
removeCustomSurvivalPlot={
this.props.store.removeCustomSurvivalPlot
}
removeCustomSurvivalPlot={this.onDeleteSurvivalPlot}
/>
);
} else {
Expand Down Expand Up @@ -1098,6 +1102,7 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
.analysisGroups;
const patientToAnalysisGroups = this.analysisGroupsComputations
.result!.patientToAnalysisGroups;
const patientSurvivals = this.props.store.patientSurvivals.result!;
const attributeDescriptions: { [prefix: string]: string } = {};
const survivalTitleByPrefix = this.survivalTitleByPrefix.result!;
const survivalYLabel = this.survivalYLabel.result!;
Expand Down Expand Up @@ -1137,16 +1142,15 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
}
// if there is no table, pick the first one from the default store
else {
this.setSurvivalPlotPrefix(
_.keys(this.props.store.patientSurvivals.result!)[0]
);
this.setSurvivalPlotPrefix(_.keys(patientSurvivals)[0]);
}
}

if (this.selectedSurvivalPlotPrefix) {
const value = this.props.store.patientSurvivals.result![
this.selectedSurvivalPlotPrefix
];
if (
this.selectedSurvivalPlotPrefix &&
patientSurvivals?.[this.selectedSurvivalPlotPrefix]
) {
const value = patientSurvivals[this.selectedSurvivalPlotPrefix];
const key = this.selectedSurvivalPlotPrefix;

// // show survival plot that is just selected
Expand Down
2 changes: 0 additions & 2 deletions src/shared/lib/comparison/ComparisonStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,6 @@ export default abstract class ComparisonStore extends AnalysisStore
@action.bound
public removeCustomSurvivalPlot(prefix: string) {
if (!_.isEmpty(this.customSurvivalPlots)) {
this.selectedSurvivalPlotPrefix = undefined;

this.customSurvivalPlots = _.omitBy(
toJS(this.customSurvivalPlots),
(value, key) => key === prefix
Expand Down

0 comments on commit 83c1eb5

Please sign in to comment.