Validation onSubmit does not re-trigger with conditionally rendered fields
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
Hướng nghiên cứu
Bắt đầu với bản tái hiện tối thiểu StackBlitz được liên kết và làm theo trình tự gửi: gửi một lần, thay đổi trường điều kiện, sau đó gửi lại. Theo dõi luồng xác thực biểu mẫu React và so sánh hành vi của onSubmit với onChange; hoàn tất khi lần gửi thứ hai xác thực nhất quán trường vừa được render.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The onSubmit validator is not re-triggering after first time when a "dynamic" field has changed. In this case I'm using Zod's discriminated union to decide whether to show this or that field, but this bug happens also when using for example a superRefine to conditionally validate a field. The first submit triggers correctly the onSubmit validator, but then if we change the field and show the other input field and submit again, it does not work trigger the validator. Even with canSubmitWhenInvalid: true.
There is a similar issue #1780 that points to this error but it's not actually the same. In that issue the author resolved the issue just putting canSubmitWhenInvalid: true, but actually the problem we have found is in the validation not getting triggered.
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-q2pndiqf?file=src%2Findex.tsx
Steps to reproduce
- Click on Submit -> Should show the error for
thisField - Change the Select to the value That
- Click again on Submit -> Should show the error for
thatField, but it does not.
If we change the validators to run on onChange, it works!
It works also if after submitting you change an input or on blur.
Expected behavior
I would expect that the onSubmit validator would run on submitting the form and it would have the same result of the onChange schema validation
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: MacOS
- Browser: Chrome
- Version: 142.0.7444.60
TanStack Form adapter
react-form
TanStack Form version
1.25.0
TypeScript version
5.9.3
Additional context
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 6.8k
- Fork
- 717
- Merge trung bình
- 5 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/form
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Submit listener exceptions leave isSubmitting stuck trueCó thể đã có người làm @henricop đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
handleSubmit calls onSubmit again while a submit is still pending (since 1.33.1)Có thể đã có người làm @twotnguyen đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`isDefaultValue` is wrong when a field-level `defaultValue` is `null`Có thể đã có người làm @fenet-as đã nhận 40 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
TanStack/form#2427 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Async validator doesn't re-trigger `isValidating` after first failed validationCó thể đã có người làm @drewsephski đã nhận 44 ngày trước. Đang mở
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/form
Issue tương tự
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
lingdojo/kana-dojo#34449 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
drizzle-team/drizzle-orm#6726 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug platform-desktop platform-windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Termix-SSH/Termix#1951 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Grok provider voice list shows 5 of xAI's 28 built-in voicesCó thể đã có người làm @hkjarral đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
hkjarral/AVA-AI-Voice-Agent-for-Asterisk#883 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100