From ca3451ce14157018e0ceb72d6f80e8b9c98ed759 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 10 Oct 2024 11:36:05 +0200 Subject: [PATCH] chore: do not try to remove an icon not in DOM This occurs when using cluster, which already add/remove markers --- umap/static/umap/js/modules/rendering/ui.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/umap/static/umap/js/modules/rendering/ui.js b/umap/static/umap/js/modules/rendering/ui.js index 858a761b..87b002e1 100644 --- a/umap/static/umap/js/modules/rendering/ui.js +++ b/umap/static/umap/js/modules/rendering/ui.js @@ -36,6 +36,12 @@ const FeatureMixin = { } }, + _removeIcon: function () { + // It may not be in the DOM, and Leaflet does not deal with this + // situation + if (this._icon) Marker.prototype._removeIcon.call(this) + }, + addInteractions: function () { this.on('contextmenu editable:vertex:contextmenu', this.onContextMenu) this.on('click', this.onClick)