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

@@ -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))
}
)
}
}
/**