angular/packages/forms
Alex Rickabaugh b96f65a963 fix(forms): memoize reads of child fields in signal forms (#65802)
Previously, navigating a `FieldTree` in signal forms involved reactive reads
of the value of the parent field(s), both directly and via `.childrenMap()`.

This meant that on _any_ change to the value of a field, reactive
notifications would trigger updates of computeds, reruns of effects, etc.
So for example, this effect would run on every change to the form:

```ts
const f = form(signal({data: 'abc', unrelated: 0}));
effect(() => {
  // accessing f.data incurs a dependency on f().value() which changes
  // on every change in the whole form
  console.log(f.data().value());
});
```

This is deeply counterintuitive and troublesome when attempting to write
effect logic, and also results in `computed`s unnecessarily updating.

This change introduces the concept of a "reader" computed, which memoizes
the access of a field at a given key via the reactive graph. With this, the
same `f.data` access above now depends on the `data` reader in `f` only,
which is effectively a constant computed. As a result, the effect only
reruns on changes to `data`'s value, as intended.

PR Close #65802
2025-12-03 12:52:42 -08:00
..
signals fix(forms): memoize reads of child fields in signal forms (#65802) 2025-12-03 12:52:42 -08:00
src docs: FormArrayDirective mentions 2025-11-14 08:40:41 -08:00
test feat(core): make SimpleChanges generic (#64535) 2025-10-20 17:49:39 +00:00
BUILD.bazel build(forms): expose signal forms compat package 2025-11-14 09:23:36 -08:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json build: configure signal forms for release (#63458) 2025-08-29 14:31:35 -07:00
PACKAGE.md build: format md files 2025-11-06 10:03:05 -08:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00