Skip to content

Commit

Permalink
Fix Knockout-Contrib#341 - async rules cannot return immediately
Browse files Browse the repository at this point in the history
If an async rule returns immediately the validation of the
observable becomes inconsistent.
  • Loading branch information
jhsowter authored and crissdev committed Feb 8, 2015
1 parent ea6c240 commit 52daa10
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
6 changes: 4 additions & 2 deletions dist/knockout.validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,10 @@ function validateAsync(observable, rule, ctx) {
observable.isValidating(false);
};

//fire the validator and hand it the callback
rule.validator(observable(), unwrap(ctx.params || true), callBack);
kv.utils.async(function() {
//fire the validator and hand it the callback
rule.validator(observable(), ctx.params === undefined ? true : unwrap(ctx.params), callBack);
});
}

kv.validateObservable = function (observable) {
Expand Down
2 changes: 1 addition & 1 deletion dist/knockout.validation.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 52daa10

Please sign in to comment.