From 9f8e88a2ff3dc490a27265b35925ed9716367564 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Mon, 25 Nov 2019 10:49:16 -0500 Subject: [PATCH] Don't cache point-as-vertex extraction fix --- modules/validations/mismatched_geometry.js | 40 ++++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/validations/mismatched_geometry.js b/modules/validations/mismatched_geometry.js index 83b2b4450..f66d919b7 100644 --- a/modules/validations/mismatched_geometry.js +++ b/modules/validations/mismatched_geometry.js @@ -174,22 +174,6 @@ export function validationMismatchedGeometry(context) { } else if (geometry === 'vertex' && !allowedGeometries.vertex && allowedGeometries.point) { - var extractOnClick = null; - if (!context.hasHiddenConnections(entity.id) && - !actionExtract(entity.id, context.projection).disabled(context.graph())) { - - extractOnClick = function(context) { - var entityId = this.issue.entityIds[0]; - var action = actionExtract(entityId, context.projection); - context.perform( - action, - t('operations.extract.annotation.single') - ); - // re-enter mode to trigger updates - context.enter(modeSelect(context, [action.getExtractedNodeID()])); - }; - } - return new validationIssue({ type: type, subtype: 'point_as_vertex', @@ -209,7 +193,26 @@ export function validationMismatchedGeometry(context) { .text(t('issues.point_as_vertex.reference')); }, entityIds: [entity.id], - dynamicFixes: function() { + dynamicFixes: function(context) { + + var entityId = this.entityIds[0]; + + var extractOnClick = null; + if (!context.hasHiddenConnections(entityId) && + !actionExtract(entityId, context.projection).disabled(context.graph())) { + + extractOnClick = function(context) { + var entityId = this.issue.entityIds[0]; + var action = actionExtract(entityId, context.projection); + context.perform( + action, + t('operations.extract.annotation.single') + ); + // re-enter mode to trigger updates + context.enter(modeSelect(context, [action.getExtractedNodeID()])); + }; + } + return [ new validationIssueFix({ icon: 'iD-operation-extract', @@ -217,8 +220,7 @@ export function validationMismatchedGeometry(context) { onClick: extractOnClick }) ]; - }, - hash: typeof extractOnClick, // avoid stale extraction fix + } }); }