Skip to content

Commit 1e89c54

Browse files
AliyanHprushforth
authored andcommitted
add condition for resetFeature for the connectedCallback case of map-feature
1 parent 1ccf354 commit 1e89c54

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/mapml/layers/FeatureLayer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ export var FeatureLayer = L.FeatureGroup.extend({
168168
this._resetFeatures();
169169
},
170170

171+
// remove or add features based on the min max attribute of the features,
172+
// and add placeholders to maintain position
171173
_resetFeatures: function () {
172174
// since features are removed and re-added by zoom level, need to clean the feature index before re-adding
173175
if (this._map) this._map.featureIndex.cleanIndex();
@@ -190,7 +192,11 @@ export var FeatureLayer = L.FeatureGroup.extend({
190192
);
191193
// removing the rendering without removing the feature from the feature list
192194
this.removeLayer(featureGroupLayer);
193-
} else if (!map.hasLayer(featureGroupLayer)) {
195+
} else if (
196+
// checking for _map so we do not enter this code block during the connectedCallBack of the map-feature
197+
!map.hasLayer(featureGroupLayer) &&
198+
!featureGroupLayer._map
199+
) {
194200
this.addLayer(featureGroupLayer);
195201
// update the layerbounds
196202
let placeholder =

0 commit comments

Comments
 (0)