map.operationalLayers repeating Layer

979
10
05-15-2019 01:41 PM
MKa
by
Occasional Contributor III

Has anyone ever had an issue with the operational layers repeating a layer when looping through them?  It seems to happen on mobile devices and on appstudio mobile but not on desktop app.  

I am simply wanting to loop though the layers, but I seem to have a repeating layer.  

 map.operationalLayers.forEach(function(value) {
    popupMessageBox.messageText += "\nvalue.name = " + value.name
 });‍‍‍

In this above example with 4 layers, the first time I run it, it gives me this result

layer.name = 1
layer.name = 2
layer.name = 3
layer.name = 4

Then I run it again and I get this result.  It seems to happen intermittently and only on my mobile device

 

layer.name = 1
layer.name = 2
layer.name = 2
layer.name = 4

Wondering if anyone has seen this type of behavior?

0 Kudos
10 Replies
MKa
by
Occasional Contributor III

I just created a Web map with these layers

I then call up a MapView page pointing to this Web Map and loader like the code I have above.  It give me duplicates for the the operational layers when I loop through the layers on the load of the map.  This happens when I Pop the MapView off and then back on, which in turn forces the map on the mapview to reload as it is a new page.  It happens about every other time and ONLY on my mobile devices.  

0 Kudos