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

Add/remove IP ranges #1930

Merged
merged 14 commits into from
Feb 5, 2024
Merged

Add/remove IP ranges #1930

merged 14 commits into from
Feb 5, 2024

Conversation

david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Feb 1, 2024

Followup to #1603
Closes #1937

The most interesting part is the IP range validation. I manually confirmed that Rust's std::net considers the same IPs valid and invalid as my regexes:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=babc49cd34bf19669137e22b9202d2eb

2024-02-04-ip-range-form.mp4

Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Feb 5, 2024 5:33am

// like a pain

return errors ? { values: {}, errors } : { values, errors: {} }
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It turns out writing a custom resolver to validate multiple fields together is very easy. We could do this more often. The only problem is that I think it can't be used with other kinds of validation. For example, I think the required prop below is being ignored because of this resolver. In this case, that's fine because empty string is not valid IP, so we catch it here.

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

Successfully merging this pull request may close these issues.

Confirm action modal should have variants
1 participant