Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Signal form children initialization is not really lazy

Abierto
#70,627 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
50/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
angular, typescript

Línea de trabajo

Comienza ejecutando la reproducción mínima en https://github.com/ShacharHarshuv/angular-form-bug e inspecciona la implementación de @angular/forms junto con el commit 98c5afdb02192f99c886fc3fda13ec6f39018f23. Se considera terminado cuando inicializar un formulario con muchos elementos secundarios directos o profundamente anidados ya no crea eagerly cada FormTree ni bloquea el hilo principal, mientras la validación a nivel de array sigue siendo posible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: forms gemini-triaged
Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

When you initialize a form with many children (either direct children or deep descendants), a FormTree is initialized for each one recursively eagerly. The initialization happens in the next loop, but when it starts it happens synchronously, making the main thread unresponsive. If the data is big enough, the browser crashes with error code "SIGILL", which seems to be a memory issue.

This commit seem to suggest that it shouldn't happen that way: https://github.com/angular/angular/commit/98c5afdb02192f99c886fc3fda13ec6f39018f23. Rather, since none of the children have any validations, or are accessed in anyway, I expect Angular not to create the FormTree for the children. In this case, the form will just keep a reference to the big array.

On the surface, you might think that this is not a valid usecase form should represent the user edited model. But you can think of situations in which a user import data (via a file upload for example) which becomes part of the model of the form, and might be saved etc. In this case and similar it's unnatural and creates extra work to separate the array from the form model (especially if you need validations on the array level (like length), even if you don't need it for the internal values)

Please provide a link to a minimal reproduction of the bug

https://github.com/ShacharHarshuv/angular-form-bug

Please provide the exception or error you saw
Browser crashes with SIGILL error, it looks like an out of memory issue. In less extreme situation, it doesn't crash but a lot of memory is used, and the main thread is stuck.
Please provide the environment you discovered this bug in (run ng version)

Anything else?

Angular CLI : 22.1.7
Angular : 22.1.5
Node.js : 24.18.0
Package Manager : npm 11.16.0
Operating System : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.7 │ ^22.1.7 │
│ @angular/cli │ 22.1.7 │ ^22.1.7 │
│ @angular/common │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler-cli │ 22.1.5 │ ^22.1.0 │
│ @angular/core │ 22.1.5 │ ^22.1.0 │
│ @angular/forms │ 22.1.5 │ ^22.1.0 │
│ @angular/platform-browser │ 22.1.5 │ ^22.1.0 │

Lenguaje dominante
TypeScript
Estrellas
101k
Forks
28.1k
Merge medio
2 d 6 h
PR fusionados (30 d)
307

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de angular/angular

Todos los issues de angular/angular

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.