Skip to content

Commit 10e8768

Browse files
[issue-9355] fix error on e2e tests
1 parent dcf5836 commit 10e8768

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/app/suggestion-notifications/suggestions.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { hasValue, isNotEmpty } from '../shared/empty.util';
1111
import { ResearcherProfile } from '../core/profile/model/researcher-profile.model';
1212
import {
1313
getAllSucceededRemoteDataPayload,
14-
getFinishedRemoteData,
14+
getFinishedRemoteData, getFirstCompletedRemoteData,
1515
getFirstSucceededRemoteDataPayload,
1616
getFirstSucceededRemoteListPayload
1717
} from '../core/shared/operators';
@@ -155,10 +155,10 @@ export class SuggestionsService {
155155
*/
156156
public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
157157
return this.researcherProfileService.findById(userUuid, true).pipe(
158-
getFirstSucceededRemoteDataPayload(),
159-
mergeMap((profile: ResearcherProfile) => {
160-
if (isNotEmpty(profile)) {
161-
return this.researcherProfileService.findRelatedItemId(profile).pipe(
158+
getFirstCompletedRemoteData(),
159+
mergeMap((profile: RemoteData<ResearcherProfile> ) => {
160+
if (isNotEmpty(profile) && profile.hasSucceeded && isNotEmpty(profile.payload)) {
161+
return this.researcherProfileService.findRelatedItemId(profile.payload).pipe(
162162
mergeMap((itemId: string) => {
163163
return this.suggestionsDataService.getTargetsByUser(itemId).pipe(
164164
getFirstSucceededRemoteListPayload()
@@ -169,7 +169,7 @@ export class SuggestionsService {
169169
return of([]);
170170
}
171171
}),
172-
take(1)
172+
catchError(() => of([]))
173173
);
174174
}
175175

0 commit comments

Comments
 (0)