From 26e396fcc65d3c71f23b8e67ad5edab11ac65381 Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Thu, 1 Aug 2024 18:18:06 -0400 Subject: [PATCH 1/2] prevent plots tab data from loading when not in plots tab --- src/pages/resultsView/ResultsViewPage.tsx | 6 ++---- src/pages/studyView/StudyViewPage.tsx | 5 +---- src/shared/components/plots/PlotsTab.tsx | 26 +++++++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/pages/resultsView/ResultsViewPage.tsx b/src/pages/resultsView/ResultsViewPage.tsx index 62a0868d13a..bd630273a9f 100644 --- a/src/pages/resultsView/ResultsViewPage.tsx +++ b/src/pages/resultsView/ResultsViewPage.tsx @@ -313,10 +313,8 @@ export default class ResultsViewPage extends React.Component< driverAnnotationSettings={ store.driverAnnotationSettings } - studyIdToStudy={store.studyIdToStudy.result} - structuralVariants={ - store.structuralVariants.result - } + studyIdToStudy={store.studyIdToStudy} + structuralVariants={store.structuralVariants} hugoGeneSymbols={store.hugoGeneSymbols} selectedGenericAssayEntitiesGroupByMolecularProfileId={ store.selectedGenericAssayEntitiesGroupByMolecularProfileId diff --git a/src/pages/studyView/StudyViewPage.tsx b/src/pages/studyView/StudyViewPage.tsx index c99856eca9b..f5b2c369f11 100644 --- a/src/pages/studyView/StudyViewPage.tsx +++ b/src/pages/studyView/StudyViewPage.tsx @@ -850,15 +850,13 @@ export default class StudyViewPage extends React.Component< .driverAnnotationSettings } studyIdToStudy={ - this.store.studyIdToStudy.result + this.store.studyIdToStudy } structuralVariants={ this.store.structuralVariants - .result } hugoGeneSymbols={ this.store.allHugoGeneSymbols - .result } selectedGenericAssayEntitiesGroupByMolecularProfileId={ this.store @@ -873,7 +871,6 @@ export default class StudyViewPage extends React.Component< genePanelDataForAllProfiles={ this.store .genePanelDataForAllProfiles - .result } patients={this.store.patients} /> diff --git a/src/shared/components/plots/PlotsTab.tsx b/src/shared/components/plots/PlotsTab.tsx index d1890336965..d665b4dd1df 100644 --- a/src/shared/components/plots/PlotsTab.tsx +++ b/src/shared/components/plots/PlotsTab.tsx @@ -328,9 +328,9 @@ export interface IPlotsTabProps { [studyId: string]: MolecularProfile; }>; driverAnnotationSettings: DriverAnnotationSettings; - studyIdToStudy?: _.Dictionary; - structuralVariants?: StructuralVariant[]; - hugoGeneSymbols: string[]; + studyIdToStudy?: MobxPromiseUnionTypeWithDefault<_.Dictionary>; + structuralVariants?: MobxPromiseUnionType; + hugoGeneSymbols: string[] | MobxPromiseUnionTypeWithDefault; selectedGenericAssayEntitiesGroupByMolecularProfileId: { [molecularProfileId: string]: string[]; }; @@ -339,7 +339,7 @@ export interface IPlotsTabProps { }>; urlWrapper: ResultsViewURLWrapper | StudyViewURLWrapper; hasNoQueriedGenes?: boolean; - genePanelDataForAllProfiles?: GenePanelData[]; + genePanelDataForAllProfiles?: MobxPromiseUnionType; queryContainsOql?: boolean; includeGermlineMutations?: boolean; mutationsReportByGene?: MobxPromise<{ @@ -3477,7 +3477,7 @@ export default class PlotsTab extends React.Component { private scatterPlotTooltip(d: IScatterPlotData) { return scatterPlotTooltip( d, - this.props.studyIdToStudy || {}, + this.props.studyIdToStudy?.result!, this.horzLogScaleFunction, this.vertLogScaleFunction, this.coloringMenuSelection.selectedOption && @@ -3489,7 +3489,7 @@ export default class PlotsTab extends React.Component { private waterfallPlotTooltip(d: IWaterfallPlotData) { return waterfallPlotTooltip( d, - this.props.studyIdToStudy || {}, + this.props.studyIdToStudy?.result!, this.coloringMenuSelection.selectedOption && this.coloringMenuSelection.selectedOption.info.clinicalAttribute ); @@ -3501,7 +3501,7 @@ export default class PlotsTab extends React.Component { if (this.boxPlotData.isComplete) { content = boxPlotTooltip( d, - this.props.studyIdToStudy || {}, + this.props.studyIdToStudy?.result!, this.boxPlotData.result.horizontal, this.boxPlotData.result.horizontal ? this.horzLogScaleFunction @@ -3683,7 +3683,7 @@ export default class PlotsTab extends React.Component { // we don't want to allow the data to be viewed by variantClass (Variant Type in UI) so remove // that from the options const filterStructuralVariantOptions = _.every( - this.props.structuralVariants, + this.props.structuralVariants?.result || [], sv => { return !sv.variantClass || sv.variantClass === 'NA'; } @@ -3818,7 +3818,9 @@ export default class PlotsTab extends React.Component { this.vertGenericAssayOptions.result, selectedEntities, this._vertGenericAssaySearchText, - this.props.hugoGeneSymbols, + Array.isArray(this.props.hugoGeneSymbols) + ? this.props.hugoGeneSymbols + : this.props.hugoGeneSymbols.result, this.horzSelection.selectedGeneOption?.label, GENERIC_ASSAY_CONFIG.genericAssayConfigByType[ axisSelection.dataType! @@ -3846,7 +3848,9 @@ export default class PlotsTab extends React.Component { this.horzGenericAssayOptions.result, selectedEntities, this._horzGenericAssaySearchText, - this.props.hugoGeneSymbols, + Array.isArray(this.props.hugoGeneSymbols) + ? this.props.hugoGeneSymbols + : this.props.hugoGeneSymbols.result, this.vertSelection.selectedGeneOption?.label, GENERIC_ASSAY_CONFIG.genericAssayConfigByType[ axisSelection.dataType! @@ -3889,7 +3893,7 @@ export default class PlotsTab extends React.Component { options = options.filter(stringCompare).slice(0, 10); const genes = await fetchGenes(options.map(o => o.label)); const coverageInformationPromise = getCoverageInformation( - this.props.genePanelDataForAllProfiles!, + this.props.genePanelDataForAllProfiles?.result || [], this.props.sampleKeyToSample.result!, this.props.patients.result!, genes From 3cd850f42b71c9ba13882a1852cb8e01b8d17d2a Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Wed, 21 Aug 2024 17:18:38 -0400 Subject: [PATCH 2/2] improve conditionality --- src/pages/studyView/StudyViewPage.tsx | 2 +- src/shared/components/plots/PlotsTab.tsx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/studyView/StudyViewPage.tsx b/src/pages/studyView/StudyViewPage.tsx index f5b2c369f11..6e14ee1e991 100644 --- a/src/pages/studyView/StudyViewPage.tsx +++ b/src/pages/studyView/StudyViewPage.tsx @@ -855,7 +855,7 @@ export default class StudyViewPage extends React.Component< structuralVariants={ this.store.structuralVariants } - hugoGeneSymbols={ + allHugoGeneSymbols={ this.store.allHugoGeneSymbols } selectedGenericAssayEntitiesGroupByMolecularProfileId={ diff --git a/src/shared/components/plots/PlotsTab.tsx b/src/shared/components/plots/PlotsTab.tsx index d665b4dd1df..3781401b5d2 100644 --- a/src/shared/components/plots/PlotsTab.tsx +++ b/src/shared/components/plots/PlotsTab.tsx @@ -330,7 +330,8 @@ export interface IPlotsTabProps { driverAnnotationSettings: DriverAnnotationSettings; studyIdToStudy?: MobxPromiseUnionTypeWithDefault<_.Dictionary>; structuralVariants?: MobxPromiseUnionType; - hugoGeneSymbols: string[] | MobxPromiseUnionTypeWithDefault; + hugoGeneSymbols?: string[]; + allHugoGeneSymbols?: MobxPromiseUnionTypeWithDefault; selectedGenericAssayEntitiesGroupByMolecularProfileId: { [molecularProfileId: string]: string[]; }; @@ -3812,15 +3813,16 @@ export default class PlotsTab extends React.Component { } let genericAssayOptionsCount: number = 0; let filteredGenericAssayOptionsCount: number = 0; + const hugoGeneSymbols: string[] = this.props.hugoGeneSymbols + ? this.props.hugoGeneSymbols + : this.props.allHugoGeneSymbols!.result; if (vertical && this.vertGenericAssayOptions.result) { genericAssayOptions = this.makeGenericAssayGroupOptions( this.vertGenericAssayOptions.result, selectedEntities, this._vertGenericAssaySearchText, - Array.isArray(this.props.hugoGeneSymbols) - ? this.props.hugoGeneSymbols - : this.props.hugoGeneSymbols.result, + hugoGeneSymbols, this.horzSelection.selectedGeneOption?.label, GENERIC_ASSAY_CONFIG.genericAssayConfigByType[ axisSelection.dataType! @@ -3848,9 +3850,7 @@ export default class PlotsTab extends React.Component { this.horzGenericAssayOptions.result, selectedEntities, this._horzGenericAssaySearchText, - Array.isArray(this.props.hugoGeneSymbols) - ? this.props.hugoGeneSymbols - : this.props.hugoGeneSymbols.result, + hugoGeneSymbols, this.vertSelection.selectedGeneOption?.label, GENERIC_ASSAY_CONFIG.genericAssayConfigByType[ axisSelection.dataType! @@ -3893,7 +3893,7 @@ export default class PlotsTab extends React.Component { options = options.filter(stringCompare).slice(0, 10); const genes = await fetchGenes(options.map(o => o.label)); const coverageInformationPromise = getCoverageInformation( - this.props.genePanelDataForAllProfiles?.result || [], + this.props.genePanelDataForAllProfiles!.result!, this.props.sampleKeyToSample.result!, this.props.patients.result!, genes