Skip to content

Commit

Permalink
Merge pull request #1226 from Esri/1225-setwhere-after-editing
Browse files Browse the repository at this point in the history
addFeatures and updateFeatures fix
  • Loading branch information
gavinr authored Aug 6, 2020
2 parents 2e32238 + 3b8f27f commit 508560c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Layers/FeatureLayer/FeatureManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,19 @@ export var FeatureManager = FeatureGrid.extend({
},

_addFeatures: function (features, coords) {
var key = this._cacheKey(coords);
this._cache[key] = this._cache[key] || [];
// coords is optional - will be false if coming from addFeatures() function
if (coords) {
var key = this._cacheKey(coords);
this._cache[key] = this._cache[key] || [];
}

for (var i = features.length - 1; i >= 0; i--) {
var id = features[i].id;

if (this._currentSnapshot.indexOf(id) === -1) {
this._currentSnapshot.push(id);
}
if (this._cache[key].indexOf(id) === -1) {
if (typeof key !== 'undefined' && this._cache[key].indexOf(id) === -1) {
this._cache[key].push(id);
}
}
Expand Down Expand Up @@ -567,7 +570,7 @@ export var FeatureManager = FeatureGrid.extend({
? response[i].objectId
: response.objectId;
}
this.createLayers(featuresArray);
this._addFeatures(featuresArray);
}

if (callback) {
Expand All @@ -593,7 +596,7 @@ export var FeatureManager = FeatureGrid.extend({
for (var i = featuresArray.length - 1; i >= 0; i--) {
this.removeLayers([featuresArray[i].id], true);
}
this.createLayers(featuresArray);
this._addFeatures(featuresArray);
}

if (callback) {
Expand Down

0 comments on commit 508560c

Please sign in to comment.