angular/packages/forms/signals/test/node
Alex Rickabaugh bf1c12cd93 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:43 -08:00
..
api fix(forms): Set error message of a schema error. 2025-11-17 17:41:57 +00:00
compat build(forms): expose signal forms compat package 2025-11-14 17:23:39 +00:00
BUILD.bazel refactor(forms): add compatForm 2025-11-06 18:51:31 +00:00
dynamic.spec.ts feat(forms): add experimental signal-based forms (#63408) 2025-08-28 09:02:43 -07:00
field_context.spec.ts refactor(forms): expose pathKeys as part of the API 2025-11-06 21:43:15 +00:00
field_node.spec.ts refactor(forms): Make reset take value 2025-11-25 10:51:38 -05:00
field_proxy.spec.ts fix(forms): memoize reads of child fields in signal forms (#65802) 2025-12-03 12:52:43 -08:00
form.spec.ts feat(forms): add experimental signal-based forms (#63408) 2025-08-28 09:02:43 -07:00
logic_node.spec.ts refactor(forms): expose pathKeys as part of the API 2025-11-06 21:43:15 +00:00
path.spec.ts feat(forms): add experimental signal-based forms (#63408) 2025-08-28 09:02:43 -07:00
recursive_logic.spec.ts refactor(forms): add compatForm 2025-11-06 18:51:31 +00:00
resource.spec.ts refactor(forms): add compatForm 2025-11-06 18:51:31 +00:00
submit.spec.ts refactor(forms): add onError callback to validateHttp for HTTP errors 2025-10-27 17:12:28 +01:00
types.spec.ts refactor(forms): allow FieldTree of recursive type 2025-11-06 21:43:46 +00:00
validation_status.spec.ts refactor(forms): add compatForm 2025-11-06 18:51:31 +00:00