From 06c28d54a9edae013dbc673a517f9fc924fbbc50 Mon Sep 17 00:00:00 2001 From: Dave Tapley Date: Thu, 11 Feb 2021 16:49:32 -0700 Subject: [PATCH] Disregard stale DynamicMapLayer updates Alleviates (1) by not updating layer with image for a set of params which have changed while request was in flight. (1) https://github.com/Esri/esri-leaflet/issues/749 --- src/Layers/DynamicMapLayer.js | 2 ++ src/Layers/RasterLayer.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Layers/DynamicMapLayer.js b/src/Layers/DynamicMapLayer.js index 128af59c6..053f9fb25 100644 --- a/src/Layers/DynamicMapLayer.js +++ b/src/Layers/DynamicMapLayer.js @@ -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) { diff --git a/src/Layers/RasterLayer.js b/src/Layers/RasterLayer.js index cb1aa7d00..c1de453ef 100644 --- a/src/Layers/RasterLayer.js +++ b/src/Layers/RasterLayer.js @@ -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);