Skip to content

Commit

Permalink
Fix infinite reload of sample lists
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Jun 7, 2023
1 parent bf23302 commit f7e8138
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions src/shared/components/query/QueryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,12 @@ export class QueryStore {
@observable private _selectedSampleListId?: string = undefined; // user selection
@computed
public get selectedSampleListId() {
if (this._selectedSampleListId !== undefined)
return this._selectedSampleListId;
return this.defaultSelectedSampleListId;
const matchesSelectedStudy = this.sampleListInSelectedStudies.result.some(
sampleList => sampleList.sampleListId === this._selectedSampleListId
);
return matchesSelectedStudy
? this._selectedSampleListId
: this.defaultSelectedSampleListId;
}

public set selectedSampleListId(value) {
Expand Down Expand Up @@ -1004,14 +1007,6 @@ export class QueryStore {
);
},
default: [],
onResult: () => {
if (
!this.initiallySelected.sampleListId ||
this.studiesHaveChangedSinceInitialization
) {
this._selectedSampleListId = undefined;
}
},
});

readonly validProfileIdSetForSelectedStudies = remoteData({
Expand Down Expand Up @@ -1075,7 +1070,7 @@ export class QueryStore {
return _.sumBy(this.selectableSelectedStudies, s => s.allSampleCount);
}

readonly sampleLists = remoteData({
readonly sampleLists = remoteData<SampleList[]>({
invoke: async () => {
if (!this.isSingleNonVirtualStudySelected) {
return [];
Expand All @@ -1088,14 +1083,6 @@ export class QueryStore {
return _.sortBy(sampleLists, sampleList => sampleList.name);
},
default: [],
onResult: () => {
if (
!this.initiallySelected.sampleListId ||
this.studiesHaveChangedSinceInitialization
) {
this._selectedSampleListId = undefined;
}
},
});

readonly mutSigForSingleStudy = remoteData({
Expand Down Expand Up @@ -2295,21 +2282,12 @@ export class QueryStore {

let urlParams = this.asyncUrlParams.result;

if (this.forDownloadTab) {
formSubmit(
buildCBioPortalPageUrl('data_download'),
urlParams.query,
undefined,
'smart'
);
} else {
this.singlePageAppSubmitRoutine(urlParams.query, currentTab);
}
this.singlePageAppSubmitRoutine(urlParams.query, currentTab);

return true;
}

@action openSummary() {
openSummary() {
if (!this.summaryEnabled) {
return;
}
Expand Down

0 comments on commit f7e8138

Please sign in to comment.