feat(form): ✨ add AutoFormNullableNumber component for nullable numeric input#724
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2d484e1d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| // Remember the last numeric value so unchecking the toggle restores it. | ||
| const lastNumericRef = React.useRef( | ||
| typeof field.value === "number" ? field.value : 0, |
There was a problem hiding this comment.
Restore a nullable number within its minimum
This initializes the value restored after unchecking the nullable toggle to 0 whenever the field starts as null. For fields with a positive minimum (the new docs example uses default(null) with min={1}), unchecking “Unlimited/Never” writes 0 into the form, immediately violating the schema and leaving the form invalid until the user edits the input. Seed the fallback from the input/schema minimum, or require an initial valid number for nullable defaults.
Useful? React with 👍 / 👎.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?