mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 05:23:06 +00:00
[CST-6876] Refactoring in order to remove nested subscriptions
This commit is contained in:
@@ -120,11 +120,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
this.searchOptions$.subscribe(() => this.updateFilterValueList()),
|
||||
this.refreshFilters.asObservable().pipe(
|
||||
filter((toRefresh: boolean) => toRefresh),
|
||||
).subscribe(() => {
|
||||
this.retrieveFilterValues(false);
|
||||
})
|
||||
mergeMap(() => this.retrieveFilterValues(false))
|
||||
).subscribe()
|
||||
);
|
||||
this.retrieveFilterValues();
|
||||
this.retrieveFilterValues().subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +278,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
return getFacetValueForType(facet, this.filterConfig);
|
||||
}
|
||||
|
||||
protected retrieveFilterValues(useCachedVersionIfAvailable = true) {
|
||||
protected retrieveFilterValues(useCachedVersionIfAvailable = true): Observable<RemoteData<PaginatedList<FacetValue>[]>> {
|
||||
const facetValues$ = observableCombineLatest([this.searchOptions$, this.currentPage]).pipe(
|
||||
map(([options, page]) => {
|
||||
return { options, page };
|
||||
@@ -301,8 +300,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
|
||||
let filterValues = [];
|
||||
this.subs.push(
|
||||
facetValues$.pipe(
|
||||
return facetValues$.pipe(
|
||||
mergeMap((facetOutcome) => {
|
||||
const newValues$ = facetOutcome.values;
|
||||
|
||||
@@ -333,8 +331,8 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
})
|
||||
);
|
||||
})
|
||||
).subscribe((rd: RemoteData<PaginatedList<FacetValue>[]>) => {
|
||||
}),
|
||||
tap((rd: RemoteData<PaginatedList<FacetValue>[]>) => {
|
||||
this.animationState = 'ready';
|
||||
this.filterValues$.next(rd);
|
||||
})
|
||||
|
Reference in New Issue
Block a user