Esri / angular-cli-esri-map

Example Angular component for building mapping applications with the ArcGIS API for JavaScript
https://stackblitz.com/edit/angular-cli-esri-map3
Apache License 2.0
89 stars 48 forks source link

Document handling change detection in Angular components #70

Closed andygup closed 4 years ago

andygup commented 4 years ago

Reference: https://github.com/Esri/esri-loader/issues/234

andygup commented 4 years ago

TL;DR Handling of change detection between the ArcGIS API for JavaScript and Angular components has not been public documented.

ArcGIS API 4.x for JavaScript does have a direct affect on triggering component change detection and the most visible side effect can be performance issues in certain circumstances. There are several well-known approaches to addressing this including ngZone.runOutsideAngular and manual change detection using ChangeDetectorRef. The best approach is dependent on the customer's existing architecture.

There are several options for this repo: Option A: address this discussion in a new wiki here: https://github.com/Esri/angular-cli-esri-map/wiki and leave the current branches "as-is". Option B: update master and the arcgis-webpack-angular branches to reflect one of these approaches. Option C: create a new branch based on master that reflects one of these approaches. Option D: do a combination of Option A and Option B or Option C

I'm leaning towards initially going with Option A since there are some quirks to the two approaches that are touched upon in https://github.com/Esri/esri-loader/issues/234. It would be helpful to get more feedback from the community. And, for example you do incur some technical debt if you go with ChangeDectorRef reference: https://www.andygup.net/manual-change-detection-in-angular-for-performance/