Skip to content

Commit 3ecdfe4

Browse files
122357: Ensure the request href$ observable aren't triggered multiple times
1 parent ca86437 commit 3ecdfe4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/app/core/data/base/base-data.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.dspace.org/license/
77
*/
88

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

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

303305
this.createAndSendGetRequest(requestHref$, useCachedVersionIfAvailable);

0 commit comments

Comments
 (0)