Skip to content

Commit

Permalink
Disregard stale DynamicMapLayer updates
Browse files Browse the repository at this point in the history
Alleviates (1) by not updating layer
with image for a set of params which have changed
while request was in flight.

(1) Esri#749
  • Loading branch information
davetapley committed Feb 11, 2021
1 parent 63b6a2a commit 06c28d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export var DynamicMapLayer = RasterLayer.extend({
_requestExport: function (params, bounds) {
if (this.options.f === 'json') {
this.service.request('export', params, function (error, response) {
if(this.latestRequestParams !== params) { return; }

if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire

if (this.options.token && response.href) {
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/RasterLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export var RasterLayer = Layer.extend({

var params = this._buildExportParams();
Util.extend(params, this.options.requestParams);

this.latestRequestParams = params
if (params) {
this._requestExport(params, bounds);

Expand Down

0 comments on commit 06c28d5

Please sign in to comment.