Hello,
I'm running into an issue where cluster counts are incorrect after using applyEdits on a feature layer at certain zoom levels. The feature layer uses the cluster feature reduction method.
For example, I start with a cluster of 15 features. There's a refresh that occurs every 60 seconds, which updates the properties of each feature in the layer. The applyEdits function is called and these updated features are provided to the updateFeatures argument like this:
await featureLayer.applyEdits({
updateFeatures: updatedFeatures
});
When the refresh completes, all appears to be well. The cluster of 15 features is still there. If I zoom in, it breaks into two clusters of 4 and 11. However, the cluster labels for these will say 8 and 22. If I zoom in a little bit more, the cluster labels go back to their correct count. If I zoom in again, they switch back to the incorrect count, and so on.
So it seems that zooming in and out alternates between cluster labels being correct and incorrect. This only happens after using applyEdits during the refresh. When the labels are incorrect, their value usually double the correct amount. I can click the cluster with a label of 22 and see that it actually contains 11 via the popup.
Is this a known issue, or am I perhaps doing something incorrectly? I have screenshots of this behavior, but it seems I'm not allowed to post images. I can also provide more code if needed, but that could take a while to adapt for a post, so I'm trying to see if there's any "easy" answer first. Thanks!
I have reproduced this behavior in a small CodePen application: https://codepen.io/rmoser3/pen/poXpKxm
This application creates a feature layer with cluster feature reduction. To reproduce the bug:
Can anyone please tell me if this is something I'm doing wrong or if this is a defect in the API?
Hi Ryan, It looks like I'm having the the same issues?
https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-clustering-count-not-correct...
Hope they will find a solution!
It works with version 4.29
Thanks for the response! Glad we're not the only one. Will definitely keep an eye out for the resolution.