From c1e3a7396f2863823ab870ef2fbaf569d4c7c7e4 Mon Sep 17 00:00:00 2001 From: Xiaoming Gao Date: Wed, 19 Dec 2018 12:05:02 -0500 Subject: [PATCH] filter validations early in history Follow @wonga00's comment in https://github.com/openstreetmap/iD/pull/5627 --- modules/core/history.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/history.js b/modules/core/history.js index 7db328d11..239034733 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -40,6 +40,7 @@ export function coreHistory(context) { var _stack; var _index; var _tree; + var validations = _filter(Validations, _isFunction); // internal _act, accepts list of actions and eased time @@ -282,7 +283,7 @@ export function coreHistory(context) { validate: function(changes) { return _flatten(_map( - _filter(Validations, _isFunction), + validations, function(fn) { return fn(context)(changes, _stack[_index].graph); }