Skip to content
This repository was archived by the owner on Feb 21, 2018. It is now read-only.
This repository was archived by the owner on Feb 21, 2018. It is now read-only.

Change detection runs continuously #15

@maxkisung

Description

@maxkisung

@tomwayson @jwasilgeo
I discovered this issue in my own project and narrowed it down to the map loading.
You can verify this by implementing NgAfterViewChecked in one of your components.

I found the solution from this post:
http://stackoverflow.com/questions/38995262/how-to-disable-angular2-change-detection-for-3rd-party-libraries

Basically you want to wrap the map and mapView loads with ngZone.runOutsideAngular(()=>{})

esri-map-view.component.ts:
ngOnInit() {
this.zone.runOutsideAngular(() => {
this.view = new MapView({
.......
}.bind(this));
});
}

map.service.ts:
constructor(private zone: NgZone) {
this.zone.runOutsideAngular(() => {
this.map = new Map({
........
});
});
}

Wrapping the the MapView seems to fix the continuous change detection,
but wrapping the Map reduced the number of rounds of change detection even further.

I haven't observed any side-effects in my own project from doing this. Hope this helps somebody. I thought this issue was going to be my demise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions