Validations Lifecycle
See original GitHub issueHello 😃
Basically, I have a form control that has synchronous validators and asynchronous.
validations: {
form: {
username: {
required, // sync validator
min: minLength(6), // sync validator
uniqueUsername, // async validator
},
},
},
The problem is that even if the synchronous ones already triggered an error the asynchronous ones still executes.
The expected behavior, considering performance issues due to unnecessary API calls, would be to execute the asynchronous validators only if the form has no errors coming from the synchronous validators.
I think that’s the Angular’s forms module behavior.
Is there a way to work around this problem? Is this a nice feature to add to the library?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Validation life cycle | CROS - European Commission
The data validation life cycle involves the activities directly linked to each statistical domain for the definition and execution of data validation.
Read more >Understanding the validator lifecycle - Attestant
This article examines the validator lifecycle in depth, showing what happens in each state and transition, what triggers transitions, ...
Read more >What's lifecycle validation? - Oracle Help Center
Lifecycle validation enforces compatible lifecycle phases between parent and component items in an item structure, at the structure name level.
Read more >The validation life cycle - PubMed
The Validation Life Cycle is an implementation mechanism which can assist pharmaceutical (and other types of medical product) manufacturers in the ...
Read more >Validation Life Cycle Support - Verista
Validation Lifecycle Support ... In fact, continued process verification is a requirement and expectation of validation per FDA requirements and guidance.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve updated my code based on the suggestion
And know its working like a charm (https://codesandbox.io/s/gallant-mendel-qdoli?file=/src/components/Form.vue:780-1006)
Based upon @shentao answer I come up with this, that worked for my case.
To avoid infinite loop we have to check each sync validation below
username
to avoid recursion.