mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
remove zone.runOutsideAngular from requestService.configure due to AoT
build issues
This commit is contained in:
@@ -80,7 +80,6 @@ export class RequestService {
|
||||
constructor(private objectCache: ObjectCacheService,
|
||||
private uuidService: UUIDService,
|
||||
private store: Store<CoreState>,
|
||||
private zone: NgZone,
|
||||
private indexStore: Store<MetaIndexState>) {
|
||||
}
|
||||
|
||||
@@ -148,30 +147,21 @@ export class RequestService {
|
||||
* @param {RestRequest} request The request to send out
|
||||
*/
|
||||
configure<T extends CacheableObject>(request: RestRequest): void {
|
||||
/**
|
||||
* Since this method doesn't return anything, is used very often and has
|
||||
* problems with actions being dispatched to the store but not reduced before
|
||||
* that info is needed again, we may as well run it in a separate zone. That way
|
||||
* it won't block the UI, and actions have a better chance of being already
|
||||
* processed when the next isCachedOrPending call comes
|
||||
*/
|
||||
this.zone.runOutsideAngular(() => {
|
||||
const isGetRequest = request.method === RestRequestMethod.GET;
|
||||
if (!isGetRequest || request.forceBypassCache || !this.isCachedOrPending(request)) {
|
||||
this.dispatchRequest(request);
|
||||
if (isGetRequest) {
|
||||
this.trackRequestsOnTheirWayToTheStore(request);
|
||||
}
|
||||
} else {
|
||||
this.getByHref(request.href).pipe(
|
||||
filter((entry) => hasValue(entry)),
|
||||
take(1)
|
||||
).subscribe((entry) => {
|
||||
return this.store.dispatch(new AddToIndexAction(IndexName.UUID_MAPPING, request.uuid, entry.request.uuid))
|
||||
}
|
||||
)
|
||||
const isGetRequest = request.method === RestRequestMethod.GET;
|
||||
if (!isGetRequest || request.forceBypassCache || !this.isCachedOrPending(request)) {
|
||||
this.dispatchRequest(request);
|
||||
if (isGetRequest) {
|
||||
this.trackRequestsOnTheirWayToTheStore(request);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.getByHref(request.href).pipe(
|
||||
filter((entry) => hasValue(entry)),
|
||||
take(1)
|
||||
).subscribe((entry) => {
|
||||
return this.store.dispatch(new AddToIndexAction(IndexName.UUID_MAPPING, request.uuid, entry.request.uuid))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user