Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-397 (pull request DSpace#1654)
Browse files Browse the repository at this point in the history
[DSC-397] fix issue that lead to failing e2e
  • Loading branch information
FrancescoMolinaro committed May 3, 2024
2 parents e53b885 + 910ab10 commit 4d840b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/search-navbar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 11 additions & 3 deletions src/app/core/browse/search-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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[] {
Expand Down

0 comments on commit 4d840b5

Please sign in to comment.