From 7241e073445458e73b184687cab04a46c3396cfc Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 25 Aug 2018 00:12:21 -0400 Subject: [PATCH] Return shallow clones of features, because the hashes may change If we return the original feature, and then change the hash later as the feature merges with another, d3 won't exit/enter because it is joining on the new hash, not the originally hash. --- modules/services/vector_tile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/services/vector_tile.js b/modules/services/vector_tile.js index 1239dd06b..d34a5181a 100644 --- a/modules/services/vector_tile.js +++ b/modules/services/vector_tile.js @@ -1,3 +1,4 @@ +import _clone from 'lodash-es/clone'; import _find from 'lodash-es/find'; import _isEqual from 'lodash-es/isEqual'; import _forEach from 'lodash-es/forEach'; @@ -172,7 +173,10 @@ export default { var hash = feature.__featurehash__; if (seen[hash]) continue; seen[hash] = true; - results.push(feature); + + // return a shallow clone, because the hash may change + // later if this feature gets merged with another + results.push(_clone(feature)); } }