From 0499a76443a0b6c207ae85a5c39acbaa2b10582e Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Tue, 22 Jan 2019 12:56:37 -0500 Subject: [PATCH] Fixed an `entity not found` error when restoring new ways that reference unloaded nodes (closed #4108, closed #5194) --- modules/core/history.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/core/history.js b/modules/core/history.js index 000220c02..cf745c563 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -417,6 +417,14 @@ export function coreHistory(context) { if (id in base.graph.entities) { baseEntities[id] = base.graph.entities[id]; } + if (entity && entity.nodes) { + // get originals of pre-existing child nodes + _forEach(entity.nodes, function(nodeId) { + if (nodeId in base.graph.entities) { + baseEntities[nodeId] = base.graph.entities[nodeId]; + } + }); + } // get originals of parent entities too _forEach(base.graph._parentWays[id], function(parentId) { if (parentId in base.graph.entities) {