From 910ab105b2d699afcf8cdced21e30621f755d467 Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Fri, 3 May 2024 09:32:37 +0200 Subject: [PATCH] [DSC-397] fix issue that lead to failing e2e --- cypress/e2e/search-navbar.cy.ts | 2 +- src/app/core/browse/search-manager.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/search-navbar.cy.ts b/cypress/e2e/search-navbar.cy.ts index 5000dc206c5..648db17fe65 100644 --- a/cypress/e2e/search-navbar.cy.ts +++ b/cypress/e2e/search-navbar.cy.ts @@ -15,7 +15,7 @@ const page = { } }; -xdescribe('Search from Navigation Bar', () => { +describe('Search from Navigation Bar', () => { // NOTE: these tests currently assume this query will return results! const query = TEST_SEARCH_TERM; diff --git a/src/app/core/browse/search-manager.ts b/src/app/core/browse/search-manager.ts index 723fbd0436b..6c3ef6e9962 100644 --- a/src/app/core/browse/search-manager.ts +++ b/src/app/core/browse/search-manager.ts @@ -4,7 +4,7 @@ import { map, switchMap } from 'rxjs/operators'; import { PaginatedList } from '../data/paginated-list.model'; import { RemoteData } from '../data/remote-data'; import { Item } from '../shared/item.model'; -import { getFirstSucceededRemoteData } from '../shared/operators'; +import { getFirstCompletedRemoteData } from '../shared/operators'; import { BrowseEntrySearchOptions } from './browse-entry-search-options.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { ItemDataService } from '../data/item-data.service'; @@ -107,8 +107,16 @@ export class SearchManager { .filter((item) => hasValue(item)); const uuidList = this.extractUUID(items, environment.followAuthorityMetadata); - - return uuidList.length > 0 ? this.itemService.findAllById(uuidList).pipe(getFirstSucceededRemoteData()) : of(null); + return uuidList.length > 0 ? this.itemService.findAllById(uuidList).pipe( + getFirstCompletedRemoteData(), + map(data => { + if (data.hasSucceeded) { + return of(data); + } else { + of(null); + } + }) + ) : of(null); } protected extractUUID(items: Item[], metadataToFollow: FollowAuthorityMetadata[]): string[] {