Encountering a problem with Leaflet clustering using v-marker-cluster. Within the icon createFunction of the cluster, the className of children is used to determine the cluster style. Here is a snippet of this function :
const childCount = marker_cluster._markers.filter((marker) => marker.options.icon.options.className.includes("selected")).length;
// other things that do not affect childCount
return new L.DivIcon({
html: "<div>" + childCount + "</div>",
className: childCount == 0 ? "class1" : "class2"),
});
However, I noticed that sometimes class1 is displayed even when there are children with the selected class in the cluster. To confirm, I inspected the marker_cluster object and found that _childCount is 2 and _markers are empty.
How is this possible? Shouldn't _markers represent the children elements? (It generally works fine but occasionally turns up empty)