From ca02f7ed0639d96175d89ef6881b295a061066c8 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 19 Apr 2019 10:00:38 -0400 Subject: [PATCH] Must use context.graph to validate entities instead of validatedgraph This is because all the validators use it, and it's the right thing to do. As entites load from the OSM or are restored from history, the most updated version of them will be in context.graph, not validatedGraph --- modules/core/validator.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/core/validator.js b/modules/core/validator.js index 70253709b..251758a0b 100644 --- a/modules/core/validator.js +++ b/modules/core/validator.js @@ -217,21 +217,19 @@ export function coreValidator(context) { // // Run validation for several entities, supplied `entityIDs` - // It uses the "validatedGraph", so this can be called asynchronously - // as entities are loaded from OSM if we want to. // validator.validateEntities = function(entityIDs) { - _validatedGraph = _validatedGraph || context.history().base(); + var graph = context.graph(); var entitiesToCheck = entityIDs.reduce(function(acc, entityID) { - var entity = _validatedGraph.entity(entityID); + var entity = graph.entity(entityID); if (acc.has(entity)) return acc; acc.add(entity); var checkParentRels = [entity]; if (entity.type === 'node') { // include parent ways - _validatedGraph.parentWays(entity).forEach(function(parentWay) { + graph.parentWays(entity).forEach(function(parentWay) { checkParentRels.push(parentWay); acc.add(parentWay); }); @@ -239,7 +237,7 @@ export function coreValidator(context) { checkParentRels.forEach(function(entity) { // include parent relations if (entity.type !== 'relation') { // but not super-relations - _validatedGraph.parentRelations(entity).forEach(function(parentRel) { + graph.parentRelations(entity).forEach(function(parentRel) { acc.add(parentRel); }); }