Update definitionExpression from angular application after layer is added to the map not working properly.

400
0
09-27-2022 03:00 PM
JulianaCastillo
New Contributor

I have an angular application that uses JS API 4.23. 

When I load the map, I load some layers as not visible. When I toggle a button to display a layer, I apply a definition expression and instead the layer shows all features. If I change the definitionExpression or zoom in/out (not pan) the layerDefinition updates to its correct value. 

I'm using 

featLayer.definitionExpression = layerDefinition
I now have added 
 
featLayer.refresh() after updating the definitionExpression. After adding the refresh, the first time I set the definition expression, all features show up. The second time, it flashes all features and then updates itself and works fine moving forward (for that specific layer, not others) 
 
I also tried setting "featurelayer-snapshot-enabled": 0 as shown here:
https://codepen.io/U_B_U/pen/dyVLKaG?editors=1000 without any fixes
esriConfig.workers.loaderConfig!.has = {
        "featurelayer-snapshot-enabled": 0
Is this a bug? 
The layers that I load with a definition expression and visible, from the beginning work just fine. 
I need to resolve this ASAP. Thanks!
 
0 Kudos
0 Replies