diff --git a/src/mapboxgl/web-map/WebMapViewModel.ts b/src/mapboxgl/web-map/WebMapViewModel.ts index 615ca0dc..d49d7ed7 100644 --- a/src/mapboxgl/web-map/WebMapViewModel.ts +++ b/src/mapboxgl/web-map/WebMapViewModel.ts @@ -614,7 +614,7 @@ export default class WebMapViewModel extends Events { clean() { if (this.map) { this.triggerEvent('beforeremovemap', {}); - this._handler?.clean(); + this._handler ? this._handler.clean() : this.map.remove(); this.map = null; this._sourceListModel = null; this._appreciableLayers = [];