ArcGIS JavaScript API v4.19
I have some code to recorder layers. Code below is the function that does the reorder. Unfortunately, this is not working in 4.19, any ideas what I am doing wrong. The order of the layers changes but does not render on the map.
moveLayer(oldIndex: number, newIndex: number😞 void {
const mapView = this.mapFactory.getMapView();
if (!mapView) {
return;
}
const numberOfLayers = mapView.map.allLayers.length;
if (oldIndex < numberOfLayers && newIndex < numberOfLayers) {
const layer = mapView.map.allLayers.getItemAt(oldIndex);
mapView.map.allLayers.reorder(layer, newIndex);
this.updateMapLayers();
}
}