I am trying to update legacy map code to the latest ArcGIS version of 4.6 and noticed this warning in the console when querying a feature layer.
<SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">[</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">esri</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">core</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;">Promise</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">]</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> DEPRECATED</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">:</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> then</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">()</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">--</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> use </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">when</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">(</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">callback</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">,</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> errback</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;">)</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"> instead</SPAN>
So I tried to change then to when, but got when is not a function errors. I also tried running the sample code from the site and got the same errors.
view.whenLayerView(featureLayer).then(function(lyrView) {
lyrView.watch("updating", function(val) {
if (!val) { // wait for the layer view to finish updating
// query all the features available for drawing.
lyrView.queryFeatures().then(function(results) {
graphics = results;
var fragment = document.createDocumentFragment();
results.forEach(function(result, index) {
var attributes = result.attributes;
var name = attributes.ZIP + " (" +
attributes.PO_NAME + ")"
// Create a list zip codes in NY
var li = document.createElement("li");
li.classList.add("panel-result");
li.tabIndex = 0;
li.setAttribute("data-result-id", index);
li.textContent = name;
fragment.appendChild(li);
});
// Empty the current list
listNode.innerHTML = "";
listNode.appendChild(fragment);
});
}
});
});
I also tried setting the "esri-promise-compatibility" flag to 1 but that didn't help. Can't see anything in the docs or community forums about this. Anyone come across this before?