diff --git a/js/id/graph/graph.js b/js/id/graph/graph.js index ee15d68c9..74caf7ceb 100644 --- a/js/id/graph/graph.js +++ b/js/id/graph/graph.js @@ -13,6 +13,7 @@ iD.Graph = function(entities) { this.transients = {}; this._parentWays = {}; this._parentRels = {}; + this._fetches = {}; if (iD.debug) { Object.freeze(this); @@ -119,12 +120,13 @@ iD.Graph.prototype = { // Resolve the id references in a way, replacing them with actual objects. fetch: function(id) { + if (this._fetches[id]) return this._fetches[id]; var entity = this.entities[id], nodes = []; if (!entity || !entity.nodes || !entity.nodes.length) return entity; for (var i = 0, l = entity.nodes.length; i < l; i++) { nodes[i] = this.fetch(entity.nodes[i]); } - return iD.Entity(entity, {nodes: nodes}); + return (this._fetches[id] = iD.Entity(entity, {nodes: nodes})); }, difference: function (graph) { diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 9b8817f35..764fa83ae 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -80,7 +80,7 @@ iD.Map = function() { filter = function(d) { return d.midpoint ? d.way in only : d.id in only; }; } - if (all.length > 10000) { + if (all.length > 100000) { editOff(); return; }