laptop and a wrench

Bug

FeatureLayer fails to draw when modifying a query via esriRequest.setRequestPreCallback.

Last Published: October 15, 2019 ArcGIS API for JavaScript
Bug ID Number BUG-000104611
SubmittedApril 20, 2017
Last ModifiedJune 5, 2024
Applies toArcGIS API for JavaScript
Version found3.20
Operating SystemWindows OS
Operating System Version10.0 64 Bit
StatusWill Not Be Addressed

Additional Information

The problem is that setPreRequestCallback does not just intercept the query request, it intercepts other requests and not all of those requests have a where property on the content. Some checks need to be added to the setPreRequestCallback function to ensure a query task request. To test this in the sample app (http://jsbin.com/zisoqib/3/edit?js,output) just surround the var y with an if statement as follows. esriRequest.setRequestPreCallback(function (ioArgs) { var x = ioArgs.url.endsWith("query"); if(ioArgs.content && ioArgs.content.where){ var y = ioArgs.content.where.startsWith("xxx"); } return ioArgs; });

Workaround

Setting a definitionExpression on the layer causes the layer to render in the map. See this in the sample provided at http://jsbin.com/zisoqib/3/edit?js,output. Uncommenting both the definitionExpression within the properties of the layer and the line with the ioArgs.content.where, the layer renders in the map without issues.

Steps to Reproduce

Bug ID: BUG-000104611

Software:

  • ArcGIS API for JavaScript

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options