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

Async validation sets formControl to valid even if sync validation is invalid #12709

Closed
JohanDavidsson opened this issue Nov 4, 2016 · 3 comments

Comments

@JohanDavidsson
Copy link

JohanDavidsson commented Nov 4, 2016

I'm submitting a ...

[X] bug report

Current behavior

If I have a sync and a async validation on a formControl the async validation overwrites the sync validation when it comes back even if the value has changed. So if I put in something in a field that passes the sync validation the async validation triggers. However when I then change the value of the field before the last async validation have come back to something that doesn't pass the sync validation the last value async validation becomes the winning one.

Expected behavior

Probably that the async validation should be ignored if the value has changed since the request?

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/MrY2Gq03dNjp8hvET3cn?p=preview

  1. Fill in whatever@whatever.com in the input field.
  2. Within 5 seconds, change the value of the field to asdf.
  3. Wait a second or two and now the Control is valid, but asdf is not valid according to the sync validation.
  • Angular version: 2.1.12
  • Browser:: Tested in latest Chrome and Safari
  • Language:: Typescript
@xban1x
Copy link

xban1x commented Nov 15, 2016

This is still present in 2.2.0

Async validators should cancel previous validations if input has changed.

@DzmitryShylovich
Copy link
Contributor

Duplicate of #8923

DzmitryShylovich pushed a commit to DzmitryShylovich/angular that referenced this issue Jan 28, 2017
DzmitryShylovich pushed a commit to DzmitryShylovich/angular that referenced this issue Jan 29, 2017
mhevery pushed a commit that referenced this issue Feb 2, 2017
mhevery pushed a commit that referenced this issue Feb 3, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this issue Aug 11, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this issue Aug 28, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants