Skip to content

Commit

Permalink
122357: Ensure the request href$ observable aren't triggered multiple…
Browse files Browse the repository at this point in the history
… times
  • Loading branch information
alexandrevryghem committed Jan 9, 2025
1 parent ca86437 commit 3ecdfe4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/core/data/base/base-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* http://www.dspace.org/license/
*/

import { AsyncSubject, from as observableFrom, Observable, of as observableOf } from 'rxjs';
import { AsyncSubject, from as observableFrom, Observable, of as observableOf, shareReplay } from 'rxjs';
import { map, mergeMap, skipWhile, switchMap, take, tap, toArray } from 'rxjs/operators';
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
Expand Down Expand Up @@ -264,6 +264,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
isNotEmptyOperator(),
take(1),
map((href: string) => this.buildHrefFromFindOptions(href, {}, [], ...linksToFollow)),
shareReplay(1),
);

this.createAndSendGetRequest(requestHref$, useCachedVersionIfAvailable);
Expand Down Expand Up @@ -298,6 +299,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
isNotEmptyOperator(),
take(1),
map((href: string) => this.buildHrefFromFindOptions(href, options, [], ...linksToFollow)),
shareReplay(1),
);

this.createAndSendGetRequest(requestHref$, useCachedVersionIfAvailable);
Expand Down

0 comments on commit 3ecdfe4

Please sign in to comment.