Signal form children initialization is not really lazy
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
- Área
- frontend, performance
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
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
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/angular
-
area: docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
area: forms forms: signals
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
area: docs gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
area: forms forms: signals
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
area: docs area: forms
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Todos los issues de angular/angular
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
TanStack/tanstack.com#1293 ·