AnsweredAssumed Answered

v4.7 - How to redraw/refresh FeatureLayer in MapView after applyEdits? (SceneView works fine)

Question asked by danbritt on May 16, 2018
Latest reply on May 19, 2018 by danbritt

Link to github showcasing this particular issue with version 4.7.2 of the API: GitHub - danbritt/arcgis-api-refresh-issue 

 

This project uses this as a base: jsapi-resources/4.x/webpack/demo at master · Esri/jsapi-resources · GitHub  and I'm using the featurelayer from this example: ArcGIS API for JavaScript Sandbox 

 

When using applyEdits on a FeatureLayer that is in a SceneView, the new feature saves and shows up on the map. If you switch to a MapView, it saves the features correctly, but they do not show on the map unless you pan away and then back. (In my github, you can change the import at the top of webmapview.tsx to test this issue.)

 

The only way I can get the layer to refresh in a MapView is to do some weird asynchronous changing of the definitionExpression using window.setTimeout() (which hasn't been reliable), or removing and re-adding the layer to the map which causes all features to disappear for a second which isn't ideal.

 

I tried using the refresh() method of FeatureLayer but it didn't seem to do anything. I did not see any requests made in the network tab of chrome dev tools or any redrawing of the layer.

 

Is this a bug? Or is there some way to refresh the layer in a MapView that I am not seeing? Any help would be appreciated, and if I can show any more details let me know.

 

Thanks!

Outcomes