according to https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#id, the layer.id can be set so that it remains unique and, presumably static. This is not the numeric layerID value, but layer.id of the form 18d65c0f0b2-layer-29. Where is this changed?
You would include the id in the parameters passed to the layer's constructor, for example:
var layer = new FeatureLayer({ id: "myLayerID", url: "https://myServer/arcgis/rest/services/MyService/MapServer/0" });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.