Validate only one field at a time
## Bug, Feature, or Question? Feature/Question ## Current Behavior Currently, validation is running asynchronously on the whole schema (assuming you use ValidationSchema of yup). It is reasonable to run the validation on submit, however, It is extremely cumbersome to run it on every field change/blur. Especially if you have some backend validation (using yup.test). Assuming you have a couple of fields, field A, and field B - the later must go through backend validation. Every time you change field A, the validation runs both on A and B which will cause unnecessary backend calls. I also tried using the new alpha version's handleChange('fieldName') but I still experience the same behavior. ## Suggested Solutions 1. Using yup schema, using yup.reach seems reasonable, even though I'm not sure how is its performance (https://github.com/jaredpalmer/formik/issues/35) 2. Formik validate function - pass the event's field name. It will allow the developer to validate only one field at a time. ## Environment - Formik Version: 0.11.11 /1.0.0-alpha.2 - React Version: 16.2 - TypeScript Version: 2.7.2 - CodeSandbox Link: - OS: macOS High Sierra - Node Version: 8.9.4 - Package Manager and Version:
Posted by orenklein on Mar 13, 2018, 4:50 PM
Tags
Related issues
- [Meta] Feedback on granular control over Copilot changes
- unexpected status 401 Unauthorized issue
- [MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
- [CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
- Video stops playing after some minutes
- [MODEL] Claude verbose code comments by default — ignores instructions to stop.
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Software)
[Meta] Feedback on granular control over Copilot changes
unexpected status 401 Unauthorized issue
[MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
[CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
Video stops playing after some minutes
[MODEL] Claude verbose code comments by default — ignores instructions to stop.
Scope Codex VS Code chats to the current workspace/project
Update on "Co-authored-by: Copilot" in commit messages
Validate only one field at a time
## Bug, Feature, or Question? Feature/Question ## Current Behavior Currently, validation is running asynchronously on the whole schema (assuming you use ValidationSchema of yup). It is reasonable to run the validation on submit, however, It is extremely cumbersome to run it on every field change/blur. Especially if you have some backend validation (using yup.test). Assuming you have a couple of fields, field A, and field B - the later must go through backend validation. Every time you change field A, the validation runs both on A and B which will cause unnecessary backend calls. I also tried using the new alpha version's handleChange('fieldName') but I still experience the same behavior. ## Suggested Solutions 1. Using yup schema, using yup.reach seems reasonable, even though I'm not sure how is its performance (https://github.com/jaredpalmer/formik/issues/35) 2. Formik validate function - pass the event's field name. It will allow the developer to validate only one field at a time. ## Environment - Formik Version: 0.11.11 /1.0.0-alpha.2 - React Version: 16.2 - TypeScript Version: 2.7.2 - CodeSandbox Link: - OS: macOS High Sierra - Node Version: 8.9.4 - Package Manager and Version:
Comments (0)
No comments yet. Start the discussion.