Consolidate number field min/max validation and revalidate when bounds change - #3376
Open
david-crespo wants to merge 2 commits into
Open
Consolidate number field min/max validation and revalidate when bounds change#3376david-crespo wants to merge 2 commits into
david-crespo wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
fakemonster
reviewed
Sep 9, 2026
Collaborator
Author
|
I would say blocking form submit and adding the bizarre message is at worst a lateral move. But I'll PR the react-aria upgrade that fixes it in a minute anyway. |
david-crespo
added this pull request to stack #3378
September 9, 2026 23:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is prep for upgrading React Aria, which will let us turn off clamping in the number input and make
NumberFieldresponsible for enforcingminandmax. On main,DiskSizeFieldis the only number field that validates bounds for itself; the prefix length field on the external subnet form and every otherNumberFieldwith aminormaxrely on the clamping. Once clamping is off, those fields need explicit validation.So, in this PR we:
NumberFieldand deleteDiskSizeField. The validate rule that used to live inDiskSizeFieldnow runs for every number field with aminormax, with the units appended to the message ("Can be at most 32", "Must be at least 10 GiB"). That leftDiskSizeFieldas a wrapper settingunits="GiB",required, andmin={1}. Its two callers now pass those directly.depstoListboxFieldand use it on the external subnet form so changing the pool re-validates prefix length. Without this, a stale "Can be at most 32" would hang around after switching back to a v6 pool, since by default react-hook-form only re-runs validation on the field that changed.depsto disk type radio in disk create, so an existing size error updates (e.g., is cleared if appropriate) when switching between Local and Distributed instead of waiting for the next submit.This also fixes a bug on main: the clamp is display-only. Entering 64 on a v6 pool and switching to v4 shows 32 in the box, but form state still holds 64 and submit sends
prefix_length: 64. With this change, submit is blocked with a message instead.The existing e2e specs for disks, external subnets, instance create, and subnet pools pass unchanged. The external subnet prefix length test gets a submit assertion covering the display-only clamp bug.