isValidating state updates to false before debounced async validation completes

Đang mở
#2,045 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #2047 của @AdrianLea — đã đóng, không merge

Đá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
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu với bản tái hiện tối thiểu trong src/index.tsx từ ví dụ StackBlitz được liên kết và theo dõi luồng xác thực bất đồng bộ cho các input firstname liên tiếp. Tái hiện vấn đề bằng cách nhập “erro”, chờ, rồi thêm “r”; được xem là hoàn tất khi isValidating vẫn là true cho đến khi tất cả các lần xác thực đang diễn ra hoàn tất và lỗi xuất hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

v1 v2: needs investigation
Describe the bug

isValidating form state updates to false before debounced async validation completes. For example when the first async validation is resolving and a second async validation is triggered, once the first async validation resolves, isValidating is set to false even though the second async validation is still in flight.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-s6svm3er?file=src%2Findex.tsx

Steps to reproduce
  1. Type in "erro" in firstname
  2. Wait roughly half a second then add an "r" to make "error"
  3. isValidating disappears -> false
  4. After about half a second later the error appears
Expected behavior

As a user I expect, isValidating to be true whenever there is an async validation in flight. So the isValidating... text should not disappear before all async validations have completed. My specific use-case is showing a loading state while async validation is ongoing, however since the isValidating
state becomes false early this can be misleading to users.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Google Chrome

TanStack Form adapter

react-form

TanStack Form version

1.28.3

TypeScript version

v5.8.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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/form

Tất cả issue của TanStack/form

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.