In the esri js version 4.7, the feature layerview's watch method doesn't seem to be working as expected. This worked fine in the 4.6 version.
Consider the following example:
In this example, I am simply adding a feature layer and trying to watch the updating property. If you check the console logs and zoom in / change the extent, the console log never gets called. There is different behavior if you change the version of the js api referenced to 4.6.
It seems to be a fairly significant bug to me.
layerview
Jack,
I agree it does look like a bug. You need to report this to esri tech support. Until they fix this you can watch the view "updating" as a workaround.
nvm, let me double check
My first instincts were correct.
The FeatureLayerView "updating" property is only related to the fetching of data, not what is drawn as you pan the map around.
FeatureLayerView | API Reference | ArcGIS API for JavaScript 4.7
This is how it should be working, the old behavior was unintended.
Depending on what you want to do, you might want to use the "stationary" property of the View.
MapView | API Reference | ArcGIS API for JavaScript 4.7
Or maybe "interacting" to know when you are moving and panning the map around.
MapView | API Reference | ArcGIS API for JavaScript 4.7
Thanks!
Hmm. Then why does this esri sample (referencing 4.7) https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=featurelayervi...
work the way I was expecting? That sample seems to be watching the FeatureLayerView's updating property and it seems to fire when panning / zooming around the map.
Thanks for responding.
Ah, ok. That's a little different.
That sample has WebGL enabled for the FeatureLayer, which behaves differently. When WebGL is enabled, we fetch the features in tiles and not up front.
The reason it's not up front is so that we can draw much more features in WebGL than we with regular SVG.
The "updating" is still related to the fetch of data. Sorry, should have been clear with that earlier. If you disable WebGL in that sample, the query fails, but you'll notice that the "updating" property doesn't change either.
Ok, that makes sense. Thanks so much for looking into this. I still think I liked the 4.6 behavior, but at least I understand that it is related to the data retrieval being done in the layer. That is helpful. Thanks.
Also, it would have been nice for this breaking change to be listed in the release notes: