From 383dff736cc3ea044ee2239d9d965fbdffe3e8ae Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 11 Mar 2020 16:22:09 +0100 Subject: [PATCH] add comment to this.zone.runOutsideAngular --- src/app/core/data/request.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index c63490d8e7..a679577d61 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -148,6 +148,13 @@ 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)) {