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

Allow users to skip validation or to fallback to server validation #50

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

nanto
Copy link
Contributor

@nanto nanto commented Dec 30, 2024

@conform-to/zod allows user to skip validation or to fallback to server validation: conform/docs/api/zod/conformZodMessage.md at main · edmundhung/conform.

It is very helpful if conform-to-valibot also supports these features.

result[name] =
result[name] === null ||
e.message === conformValibotMessage.VALIDATION_SKIPPED
? null
Copy link
Contributor Author

@nanto nanto Dec 30, 2024

Choose a reason for hiding this comment

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

If error[name] is null, Conform reuses previous error value.

Copy link
Owner

Choose a reason for hiding this comment

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

result === null ||
e.message === conformValibotMessage.VALIDATION_UNDEFINED
) {
return null;
Copy link
Contributor Author

@nanto nanto Dec 30, 2024

Choose a reason for hiding this comment

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

If error field is null, Conform stop reporting errors and proceed with browser's built-in form submission process (don't call event.preventDefault() for submit event).

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Owner

@chimame chimame left a comment

Choose a reason for hiding this comment

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

Thanks for the great PR.
Looks good. Let's merge!

result === null ||
e.message === conformValibotMessage.VALIDATION_UNDEFINED
) {
return null;
Copy link
Owner

Choose a reason for hiding this comment

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

result[name] =
result[name] === null ||
e.message === conformValibotMessage.VALIDATION_SKIPPED
? null
Copy link
Owner

Choose a reason for hiding this comment

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

@chimame chimame merged commit 1318941 into chimame:main Dec 30, 2024
4 checks passed
Copy link

🎉 This PR is included in version 1.13.0 🎉

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.

2 participants