Add signal form config option to process async validation even when sync errors are present
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start in the Angular forms package by tracing FormOptions, validateStandardSchema, and validateAsync. Review the existing synchronous and asynchronous validation tests to determine where the proposed processAsyncValidators behavior belongs. Done means the option supports both the default whenSyncValid behavior and always, with tests covering async results when synchronous errors are present.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Which @angular/* package(s) are relevant/related to the feature request?
forms
Description
My use case involves validateStandardSchema. We have Zod schemas defined for our forms, and we are validating the forms with them using validateStandardSchema. We also have some of Angular's required() validators thrown in as well. The trouble is, we have a reused sub-schema that we need to add async validation to. This async Zod validation at some of the form leaf nodes (via async .superRefine() calls) causes the entire schema to return a promise instead of a synchronous value, and as such, Angular ignores the promise value whenever the form has other sync errors from the required() validators. To make matters worse, the Zod async validation is still run, but Angular is dropping the results on the floor.
So, my proposal is this: would it be possible/acceptable to add a configuration option to either the form itself, or to validateStandardSchema, to not ignore these async errors? I understand the reasoning to avoid expensive async validators when possible, but in this scenario, they aren't even being avoided, just ignored.
Proposed solution
Add a configuration option to FormOptions, called something like "processAsyncValidators", with possible values of "whenSyncValid" (default), and "always", which is consumed in validateAsync().
Alternatives considered
- Create separate sync and async schemas: rejected because the composable schema structure would have to be duplicated unnecessarily
- Create more granular, field-level schemas: rejected because this violates the concept of having a single standard schema for a form, and shifts complexity from the schema to the Angular component
- Ngôn ngữ chính
- TypeScript
- Star
- 101k
- Fork
- 28.1k
- Merge trung bình
- 2 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 292
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 angular/angular
-
area: docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
area: forms forms: signals
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
area: docs gemini-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
area: forms forms: signals
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
area: docs area: forms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Tất cả issue của angular/angular
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
fil-donadoni/tolaria#4409 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
corsairdev/corsair#1764 ·