remove zone.runOutsideAngular from requestService.configure due to AoT

build issues
This commit is contained in:
Art Lowel
2020-03-11 16:51:32 +01:00
parent 383dff736c
commit 795d638aa6
2 changed files with 14 additions and 26 deletions

View File

@@ -1,4 +1,3 @@
import { NgZone } from '@angular/core';
import * as ngrx from '@ngrx/store'; import * as ngrx from '@ngrx/store';
import { ActionsSubject, Store } from '@ngrx/store'; import { ActionsSubject, Store } from '@ngrx/store';
import { cold, getTestScheduler, hot } from 'jasmine-marbles'; import { cold, getTestScheduler, hot } from 'jasmine-marbles';
@@ -63,7 +62,6 @@ describe('RequestService', () => {
objectCache, objectCache,
uuidService, uuidService,
store, store,
new NgZone({}),
undefined undefined
); );
serviceAsAny = service as any; serviceAsAny = service as any;

View File

@@ -80,7 +80,6 @@ export class RequestService {
constructor(private objectCache: ObjectCacheService, constructor(private objectCache: ObjectCacheService,
private uuidService: UUIDService, private uuidService: UUIDService,
private store: Store<CoreState>, private store: Store<CoreState>,
private zone: NgZone,
private indexStore: Store<MetaIndexState>) { private indexStore: Store<MetaIndexState>) {
} }
@@ -148,30 +147,21 @@ export class RequestService {
* @param {RestRequest} request The request to send out * @param {RestRequest} request The request to send out
*/ */
configure<T extends CacheableObject>(request: RestRequest): void { configure<T extends CacheableObject>(request: RestRequest): void {
/** const isGetRequest = request.method === RestRequestMethod.GET;
* Since this method doesn't return anything, is used very often and has if (!isGetRequest || request.forceBypassCache || !this.isCachedOrPending(request)) {
* problems with actions being dispatched to the store but not reduced before this.dispatchRequest(request);
* that info is needed again, we may as well run it in a separate zone. That way if (isGetRequest) {
* it won't block the UI, and actions have a better chance of being already this.trackRequestsOnTheirWayToTheStore(request);
* 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))
}
)
} }
}); } 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))
}
)
}
} }
/** /**