You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export class AppComponent implements OnInit {
whichMap = 'first';
ngOnInit() {
// Change which map we're displaying after the current synchronous code runs
Promise.resolve(null).then(() => this.whichMap = 'second');
}
}
ERROR TypeError: Cannot read property 'remove' of undefined
at MapService.push../node_modules/ngx-mapbox-gl/fesm5/ngx-mapbox-gl.js.MapService.destroyMap (ngx-mapbox-gl.js:83)
at MapComponent.push../node_modules/ngx-mapbox-gl/fesm5/ngx-mapbox-gl.js.MapComponent.ngOnDestroy (ngx-mapbox-gl.js:3324)
Only one MapComponent constructor gets run in this scenario, so I'm unclear on why MapComponent.ngOnDestroy gets called at all.
This seems to be resolved by performing a safety check before attempting to call mapInstance.remove(). See pull request #141.
The text was updated successfully, but these errors were encountered:
While quickly switching between two mgl-map instances, a hook to destroy the instance is scheduled, but the reference is undefined when called.
app.component.html:
app.component.ts:
Only one MapComponent constructor gets run in this scenario, so I'm unclear on why MapComponent.ngOnDestroy gets called at all.
This seems to be resolved by performing a safety check before attempting to call mapInstance.remove(). See pull request #141.
The text was updated successfully, but these errors were encountered: