122357: Ensure the request href$ observable aren't triggered multiple times

(cherry picked from commit 3ecdfe422d)
This commit is contained in:
Alexandre Vryghem
2025-01-09 18:46:10 +01:00
parent 08bda53a2e
commit 8c92364d43

View File

@@ -6,7 +6,7 @@
* http://www.dspace.org/license/ * 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 { map, mergeMap, skipWhile, switchMap, take, tap, toArray } from 'rxjs/operators';
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util'; import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
@@ -264,6 +264,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
isNotEmptyOperator(), isNotEmptyOperator(),
take(1), take(1),
map((href: string) => this.buildHrefFromFindOptions(href, {}, [], ...linksToFollow)), map((href: string) => this.buildHrefFromFindOptions(href, {}, [], ...linksToFollow)),
shareReplay(1),
); );
const startTime: number = new Date().getTime(); const startTime: number = new Date().getTime();
@@ -299,6 +300,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
isNotEmptyOperator(), isNotEmptyOperator(),
take(1), take(1),
map((href: string) => this.buildHrefFromFindOptions(href, options, [], ...linksToFollow)), map((href: string) => this.buildHrefFromFindOptions(href, options, [], ...linksToFollow)),
shareReplay(1),
); );
const startTime: number = new Date().getTime(); const startTime: number = new Date().getTime();