From 7c8c8023c595b296e86c6d980a77f79493c4c0fb 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 09423eeade7..caa359ed8b2 100644 --- a/src/pages/resultsView/ResultsViewPage.tsx +++ b/src/pages/resultsView/ResultsViewPage.tsx @@ -310,10 +310,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 508fe36e461..82822028dbc 100644 --- a/src/pages/studyView/StudyViewPage.tsx +++ b/src/pages/studyView/StudyViewPage.tsx @@ -842,15 +842,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 @@ -865,7 +863,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 814df5b16f7..71caf62c8ef 100644 --- a/src/shared/components/plots/PlotsTab.tsx +++ b/src/shared/components/plots/PlotsTab.tsx @@ -326,9 +326,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[]; }; @@ -337,7 +337,7 @@ export interface IPlotsTabProps { }>; urlWrapper: ResultsViewURLWrapper | StudyViewURLWrapper; hasNoQueriedGenes?: boolean; - genePanelDataForAllProfiles?: GenePanelData[]; + genePanelDataForAllProfiles?: MobxPromiseUnionType; queryContainsOql?: boolean; includeGermlineMutations?: boolean; mutationsReportByGene?: MobxPromise<{ @@ -3346,7 +3346,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 && @@ -3358,7 +3358,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 ); @@ -3370,7 +3370,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 @@ -3552,7 +3552,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'; } @@ -3679,7 +3679,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! @@ -3707,7 +3709,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! @@ -3750,7 +3754,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 20a161aec320f043e6b52eec741b9cc61f653c55 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 82822028dbc..90d7595babc 100644 --- a/src/pages/studyView/StudyViewPage.tsx +++ b/src/pages/studyView/StudyViewPage.tsx @@ -847,7 +847,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 71caf62c8ef..80885398690 100644 --- a/src/shared/components/plots/PlotsTab.tsx +++ b/src/shared/components/plots/PlotsTab.tsx @@ -328,7 +328,8 @@ export interface IPlotsTabProps { driverAnnotationSettings: DriverAnnotationSettings; studyIdToStudy?: MobxPromiseUnionTypeWithDefault<_.Dictionary>; structuralVariants?: MobxPromiseUnionType; - hugoGeneSymbols: string[] | MobxPromiseUnionTypeWithDefault; + hugoGeneSymbols?: string[]; + allHugoGeneSymbols?: MobxPromiseUnionTypeWithDefault; selectedGenericAssayEntitiesGroupByMolecularProfileId: { [molecularProfileId: string]: string[]; }; @@ -3673,15 +3674,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! @@ -3709,9 +3711,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! @@ -3754,7 +3754,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