diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index 23c27093e0..017721fdf9 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -1,4 +1,3 @@ -import { NgZone } from '@angular/core'; import * as ngrx from '@ngrx/store'; import { ActionsSubject, Store } from '@ngrx/store'; import { cold, getTestScheduler, hot } from 'jasmine-marbles'; @@ -63,7 +62,6 @@ describe('RequestService', () => { objectCache, uuidService, store, - new NgZone({}), undefined ); serviceAsAny = service as any; diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index a679577d61..c2e7327d22 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -80,7 +80,6 @@ export class RequestService { constructor(private objectCache: ObjectCacheService, private uuidService: UUIDService, private store: Store, - private zone: NgZone, private indexStore: Store) { } @@ -148,30 +147,21 @@ export class RequestService { * @param {RestRequest} request The request to send out */ configure(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)) + } + ) + } } /**