Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed a pretty mean to track down bug which occurs when you have a async validation rule that isn't always actualy async thus there are cases for example if you already found a useful info in your cache where the callback is called with the appropriate validation result immediately after your rules validator function is called. The specific issue only occured if that result should lead to an invalid state, too.
This resulted in validity state to be changed to invalid as expected after that validation rule was processed. But unfortunately immediately after the in the end of the kv.validateObservable function observable.clearError() was called and thus the valid state was reset to be valid again.
I understand that this line is necessary so the invalid fields get actualy relesed once no rule is violated anymore but for the async validation in a rare case this happend to early so i moved that line up which worked just fine for me.