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

Don 518 explore meta campaign fixes #1803

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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
45 changes: 22 additions & 23 deletions src/app/explore/explore.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,35 +367,35 @@ export class ExploreComponent implements AfterViewChecked, OnDestroy, OnInit {
this.fundSlug,
);

if (this.metaCampaign) {
this.doCampaignSearch(query as SearchQuery, false);
}
this.doCampaignSearch(query as SearchQuery, false);
}

/**
* Also saves results for imminent future navigation to the same meta-campaign + filters.
*/
private doCampaignSearch(query: SearchQuery, clearExisting: boolean) {
this.campaignService.search(query as SearchQuery).subscribe(campaignSummaries => {
// Success
this.individualCampaigns = clearExisting ? campaignSummaries : [...this.individualCampaigns, ...campaignSummaries];
this.loading = false;
this.campaignService.search(query as SearchQuery).subscribe({
next: (campaignSummaries) => {
this.individualCampaigns = clearExisting ? campaignSummaries : [...this.individualCampaigns, ...campaignSummaries];
this.loading = false;

if (isPlatformBrowser(this.platformId)) {
// Save children so we can go 'back' here in the browser and maintain scroll position.
// Only an exact query match should reinstate the same child campaigns on load.
const recentChildrenData = {
query: this.normaliseQueryForRecentChildrenComparison(query),
offset: this.offset,
children: this.individualCampaigns,
time: Date.now(), // ms
};

this.sessionStorage.set(this.recentChildrenKey, recentChildrenData);
if (isPlatformBrowser(this.platformId)) {
// Save children so we can go 'back' here in the browser and maintain scroll position.
// Only an exact query match should reinstate the same child campaigns on load.
const recentChildrenData = {
query: this.normaliseQueryForRecentChildrenComparison(query),
offset: this.offset,
children: this.individualCampaigns,
time: Date.now(), // ms
};

this.sessionStorage.set(this.recentChildrenKey, recentChildrenData);
}
},
error: () => {
this.filterError = true;
this.loading = false;
}
}, () => {
this.filterError = true; // Error, should only be thrown if the callout SF API returns an error
this.loading = false;
});
}

Expand Down Expand Up @@ -486,8 +486,7 @@ export class ExploreComponent implements AfterViewChecked, OnDestroy, OnInit {
return;
}

void this.router.navigate(['explore'], { queryParams: nextQueryParams });
}
void this.router.navigate([], { queryParams: nextQueryParams }); }

private listenForRouteChanges() {
this.routeChangeListener = this.router.events.subscribe(event => {
Expand Down
Loading