Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update knockout.validation.js #619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Fijo
Copy link

@Fijo Fijo commented May 4, 2016

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants