diff options
-rw-r--r-- | web/transaction.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/web/transaction.js b/web/transaction.js index 8c91ff6..7c2101f 100644 --- a/web/transaction.js +++ b/web/transaction.js @@ -160,6 +160,11 @@ define( var tn = _.isObject(newValue); var npv = tn ? mpath : newValue; + var prevTask = mpath in invalid && + invalid[mpath][1] || $.Deferred().resolve(); + + invalid[mpath] = [npv, def]; + function ignore(path) { _.each(_.keys(invalid), function(p) { if (pth.isSubordinate(p, path)) @@ -180,7 +185,7 @@ define( def.resolve(isValid()); } - function validate() { + prevTask.always(function() { var del = newValue == null; var options; @@ -284,16 +289,8 @@ define( else resolve(); }).fail(reject); - } - - var prevTask; - if (mpath in invalid) prevTask = invalid[mpath][1]; - - invalid[mpath] = [npv, def]; - - if (prevTask) prevTask.always(validate); - else validate(); - + }); + return def; }; |