PROBLEM
In certain cases, when a feature is updated in a web map, the updated records are not returned when the web browser is refreshed or auto-refreshes using the refreshInterval function in ArcGIS API for JavaScript.
The following code sample demonstrates a query that fails to return the updated query response:
var featureLayer = new FeatureLayer(featureLayerUrl, { mode: FeatureLayer.MODE_ONDEMAND, refreshInterval: 0.25, visible: true, outFields: ["*"], id: "fLayer" });
Note: The above code sample refreshes the query every 0.25 minutes, or 15 seconds. The refreshInterval function refreshes the query by the number of minute(s) specified. For more information, refer to the following web help document: ArcGIS API for JavaScript: Class: Layer.
The updated records in the specified feature layer refresh interval are not returned from the service because the service is returning cached data to the query requests. There may be limited space for caching set in the web browser, which results in the edits not being registered, and hence the updates to a query are not returned.
esriRequest.setRequestPreCallback(addTimeStamp); function addTimeStamp(ioArgs) { if(ioArgs.url == (featureLayerUrl + "/query")) { ioArgs.content = ioArgs.content || {}; ioArgs.content.timeStamp = new Date().getTime(); } return ioArgs; }
Get help from ArcGIS experts
Download the Esri Support App