Bug
| Bug ID Number | BUG-000124573 |
|---|---|
| Submitted | August 16, 2019 |
| Last Modified | June 5, 2024 |
| Applies to | ArcGIS API for JavaScript |
| Version found | 4.12 |
| Operating System | Windows OS |
| Operating System Version | 10.0 |
| Status | Non-Reproducible |
Using a while loop with an iterator to prevent layerview.watch() from firing multiple queries causing the parcel pop-up glitch.
let t = 0;
searchWidget.on("search-complete", (event) => {
let resultGeometry = event.results[0].results[0].feature.geometry;
mapView.whenLayerView(layer).then((layerView) => {
console.log(layerView)
layerView.watch("updating", (val) => {
if (!val) { // wait for the layer view to finish updating
while(t === 0){
t++;
layerView.queryFeatures({
geometry: resultGeometry,
returnGeometry: true
}).then((results) => {
console.log(results);
layerView.highlight(results.features);
console.log('opening popup');
mapView.popup.open({
features: [results.features[0]],
location: results.features[0].geometry.centroid
})
});
}
}
});
});
});
Bug ID: BUG-000124573
Software:
Get help from ArcGIS experts
Download the Esri Support App