Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Add signal form config option to process async validation even when sync errors are present

Aberta
#70,815 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
angular, typescript
Domínio
frontend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: forms forms: signals
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
  1. Create separate sync and async schemas: rejected because the composable schema structure would have to be duplicated unnecessarily
  2. 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
Linguagem predominante
TypeScript
Estrelas
101k
Forks
28.1k
Merge médio
2d 8h
PRs com merge (30d)
292

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de angular/angular

Todas as issues de angular/angular

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.