I have a rather large hybrid AngularJS / Angular application that I upgraded from Angular 4 to Angular 5 to get rid of the UpgradeModule that caused excessive $digests and slowness. But now I noticed that on every AngularJS XHR request Angular 5 does change detection on every downgraded Angular 5 component. Since I have rather large tables with components in, the amount of change detection explodes and causing severe lag (like 20s instead of 0).
I have read here that NgZone can be downgraded and used to limit the calls.
But I wonder is it really needed to check every component on every XHR request?
Is there a way to limit these checks or turn them off completely on XHR requests? (for certain components perhaps?)
Any other patterns to that might help with this issue?
This is an overview that shows the delays caused by the XHR requests.
This is a detail zoomed in view:
EDIT It did help to set OnPush as changeDetection on all components, which seems logical anyway. But it still seems that each click event and XHR request (I will change to fetch here to try and avoid it) causes $digest and also causes the same call stack anyway (though less work). An example is a the component below:
@Component({
selector: "oc-filter",
templateUrl: "./header-filter.component.html",
styleUrls: ["./header-filter.component.scss"],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
})
So the stack is still very similar:
Is Angular still going through all components anyway? Is there a way to prevent this at an earlier stage?