-
-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Description
Describe the bug
When using discriminated unions and conditionally rendered fields, it's possible to get into a bad state.
It's a bit hard to explain, so see the reproduction steps + stackblitz.
It's possible that there is a better approach here that I don't see. Very open to that.
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-ccufpzmq?file=src%2Findex.tsx,package.json&preset=node
Steps to reproduce
- Click submit
- Note the validation error "thisField is required"
- Switch from "this" to "that"
- Note the Submit button is disabled and no validation errors are present
Expected behavior
Either the submit button should be enabled so that the user can submit the form and see validation errors, or validation should trigger automatically.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
TanStack Form adapter
react-form
TanStack Form version
1.23.4
TypeScript version
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels