for (var i = 0; i < markers.value.length; i++) {
new L.marker([markers.value[i].location.lat, markers.value[i].location.lon])
.addTo(markersLayer.value)
.bindTooltip(L.tooltip({ sticky: true, content: 'god' }));
}
This code snippet creates a map displaying a group of markers. An issue arises when changing the markers by clearing them with markersLayer.value.clearLayers()
and then updating the loop with a new array. The problem seems to be related to tooltips - if the line
.bindTooltip(L.tooltip({ sticky: true, content: 'god' }));
is removed, the issue cannot be reproduced. Additionally, not clearing the layer results in the first set of markers staying on the map while the new ones do not function properly.
Various attempts have been made to troubleshoot this issue, but it appears that the tooltip component may be the root cause based on its behavior being consistent with the problem.