Submit listener exceptions leave isSubmitting stuck true
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu bằng cách đọc phần triển khai FormApi.handleSubmit() trong form-core và khối xử lý lỗi khi gửi; issue cho biết các lời gọi đồng bộ đến listeners.onSubmit của form và field chạy ngay trước khối đó. Thêm kiểm thử hồi quy cho cả hai trường hợp listener, xác nhận lỗi vẫn bị reject, callback gửi bị bỏ qua và isSubmitting được đặt lại thành false trong khi isSubmitSuccessful vẫn là false. Xác nhận lần gửi thành công sau đó vẫn hoạt động và chạy bộ kiểm thử form-core.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
A synchronous exception in a form-level or field-level listeners.onSubmit rejects form.handleSubmit() but leaves form.state.isSubmitting set to true. The submit callback itself is correctly skipped, but a UI that disables its submit button while submitting stays disabled after the rejected listener.
The form already resets this lifecycle state when the main onSubmit callback throws. The listener calls currently run just before that error-handling block.
Minimal reproduction
import { FormApi } from '@tanstack/form-core'
const form = new FormApi({
defaultValues: { name: 'Ada' },
listeners: {
onSubmit: () => { throw new Error('Submit listener failed') },
},
})
form.mount()
try {
await form.handleSubmit()
} catch (error) {
console.log((error as Error).message) // Submit listener failed
}
console.log(form.state.isSubmitting) // true; expected false
The same result occurs when the throwing listener is attached to a mounted FieldApi instead of the form.
Expected behavior
The original exception should still reject handleSubmit() and prevent the submission callback from running, while isSubmitting returns to false and isSubmitSuccessful stays false. A later successful submission should work normally.
Verification
Reproduced on current main (eba4084, form-core 1.33.5), Node 24.19.0. Two regression tests (form listener and field listener) fail on main because isSubmitting remains true. Moving those synchronous listener calls into the existing submission error-handling block makes both pass; the form-core suite passes 507 tests with 3 existing todo tests and no type errors.
This report and the proposed repair were prepared with Codex assistance and checked locally. The scope is synchronous submit listener exceptions; it does not promise handling of detached asynchronous work started by a listener.
- 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
-
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
-
[v2 alpha] devtools are always light modeCó thể đã có người làm @dikshit-n đã nhận 78 ngày trước. Đang mởarea: runtime scope: devtools type: bug v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/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