-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
fix(native-validation): clear error #183
Conversation
Size Change: +1.28 kB (+6%) 🔍 Total Size: 21.6 kB
|
src/validateFieldsNatively.ts
Outdated
const error = get(errors, fieldPath) as FieldError | undefined; | ||
|
||
if (error) { | ||
field.ref.setCustomValidity(error.message || ''); | ||
} else { | ||
field.ref.setCustomValidity(''); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const error = get(errors, fieldPath) as FieldError | undefined; | |
if (error) { | |
field.ref.setCustomValidity(error.message || ''); | |
} else { | |
field.ref.setCustomValidity(''); | |
} | |
field.ref.setCustomValidity((get(errors, fieldPath) as FieldError | undefined) ? error.message || '' : ''); |
save few bytes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff! thanks a lot for the PR.
7bfbb40
to
9c4773a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
🎉 This PR is included in version 2.6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Related to #182