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

fix(native-validation): clear error #183

Merged
merged 1 commit into from
Jul 13, 2021
Merged

Conversation

jorisre
Copy link
Member

@jorisre jorisre commented Jul 11, 2021

Related to #182

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2021

Size Change: +1.28 kB (+6%) 🔍

Total Size: 21.6 kB

Filename Size Change
class-validator/dist/class-validator.js 514 B +22 B (+4%)
class-validator/dist/class-validator.modern.js 476 B +24 B (+5%) 🔍
class-validator/dist/class-validator.module.js 539 B +25 B (+5%) 🔍
class-validator/dist/class-validator.umd.js 617 B +21 B (+4%)
computed-types/dist/computed-types.js 409 B +40 B (+11%) ⚠️
computed-types/dist/computed-types.modern.js 344 B +45 B (+15%) ⚠️
computed-types/dist/computed-types.module.js 424 B +44 B (+12%) ⚠️
computed-types/dist/computed-types.umd.js 503 B +40 B (+9%) 🔍
dist/resolvers.js 313 B +51 B (+19%) ⚠️
dist/resolvers.modern.js 322 B +52 B (+19%) ⚠️
dist/resolvers.module.js 325 B +52 B (+19%) ⚠️
dist/resolvers.umd.js 412 B +53 B (+15%) ⚠️
io-ts/dist/io-ts.js 1.09 kB +20 B (+2%)
io-ts/dist/io-ts.modern.js 1.13 kB +29 B (+3%)
io-ts/dist/io-ts.module.js 1.17 kB +27 B (+2%)
io-ts/dist/io-ts.umd.js 1.23 kB +20 B (+2%)
joi/dist/joi.js 592 B +25 B (+4%)
joi/dist/joi.modern.js 492 B +30 B (+6%) 🔍
joi/dist/joi.module.js 610 B +27 B (+5%) 🔍
joi/dist/joi.umd.js 698 B +23 B (+3%)
nope/dist/nope.js 345 B +36 B (+12%) ⚠️
nope/dist/nope.modern.js 329 B +39 B (+13%) ⚠️
nope/dist/nope.module.js 365 B +43 B (+13%) ⚠️
nope/dist/nope.umd.js 434 B +36 B (+9%) 🔍
superstruct/dist/superstruct.js 302 B +37 B (+14%) ⚠️
superstruct/dist/superstruct.modern.js 314 B +44 B (+16%) ⚠️
superstruct/dist/superstruct.module.js 319 B +42 B (+15%) ⚠️
superstruct/dist/superstruct.umd.js 404 B +42 B (+12%) ⚠️
vest/dist/vest.js 459 B +23 B (+5%) 🔍
vest/dist/vest.modern.js 380 B +27 B (+8%) 🔍
vest/dist/vest.module.js 436 B +29 B (+7%) 🔍
vest/dist/vest.umd.js 548 B +23 B (+4%)
yup/dist/yup.js 602 B +23 B (+4%)
yup/dist/yup.modern.js 543 B +27 B (+5%) 🔍
yup/dist/yup.module.js 617 B +26 B (+4%)
yup/dist/yup.umd.js 702 B +21 B (+3%)
zod/dist/zod.js 563 B +18 B (+3%)
zod/dist/zod.modern.js 515 B +29 B (+6%) 🔍
zod/dist/zod.module.js 583 B +26 B (+5%) 🔍
zod/dist/zod.umd.js 670 B +18 B (+3%)

compressed-size-action

Comment on lines 12 to 18
const error = get(errors, fieldPath) as FieldError | undefined;

if (error) {
field.ref.setCustomValidity(error.message || '');
} else {
field.ref.setCustomValidity('');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

bluebill1049
bluebill1049 previously approved these changes Jul 11, 2021
Copy link
Member

@bluebill1049 bluebill1049 left a 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.

Copy link
Member

@bluebill1049 bluebill1049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@jorisre jorisre merged commit 52145b0 into master Jul 13, 2021
@jorisre jorisre deleted the fix-native-validation branch July 13, 2021 12:18
@github-actions
Copy link
Contributor

🎉 This PR is included in version 2.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shouldUseNativeValidation does not work properly with schema resolvers
2 participants