904 Commits

Author SHA1 Message Date
SkyZeroZx 7be9d5d6b2 refactor(forms): modernize signal forms tests to rely on whenStable
Rely on zoneless test scheduling instead of manually triggering change detection. Keep Signals Forms tests aligned with the async-first testing pattern.

(cherry picked from commit 59f6ef690b)
2026-07-29 09:57:42 -07:00
Kristiyan Kostadinov c836bcc693 fix(forms): add utility to assert that value is a field tree
Adds the `isFieldTree` utility that allows users to assert whether a value is a field tree. This is something that has come up on Material recently and will be useful for users as well.

Fixes #69984.

(cherry picked from commit 2a141847a5)
2026-07-29 08:53:28 -07:00
Matthieu Riegler d302c7ab83 fix(forms): ensure pending status propagates to the root form in signal forms
Previously, the `pending()` status on a field's `ValidationState` only checked if the field itself or its immediate children had a pending asynchronous validator by directly inspecting `asyncErrors()`. This meant that a pending asynchronous validator deep within a nested form (e.g. on a grand-child) would not correctly bubble the `pending` state up to the root form.

fixes #69840

(cherry picked from commit 3497c9b943)
2026-07-21 13:48:37 +02:00
Pawel Kozlowski e14ead1093 Revert "fix(forms): preserve intermediate number values in signal forms"
This reverts commit 64d6d47a0c.
2026-07-20 10:40:53 +02:00
Jaime Burgos 64d6d47a0c fix(forms): preserve intermediate number values in signal forms
Preserve raw native input text while editing so parsed model values are not written back on every keystroke.

(cherry picked from commit 2e32872720)
2026-07-15 15:56:52 -07:00
cexbrayat 70500e4067 fix(core): preserve explicit input transform write type
If a directive has an input declared as `dismissible = input<boolean>(true, {transform: booleanAttribute});` then the following templates were not compiling:

```
<div directiveName dismissible="true"></div>
<div directiveName dismissible></div>
```

This commit fixes the issue, without breaking contravariant consumers.

(cherry picked from commit 0ae6d81ed2)
2026-07-15 12:02:23 -07:00
Shuaib Hasan Akib a6174d5900 refactor(forms): warn when a text input receives a null value in Signal Forms
Native text `<input type="text">` controls do not support `null` values.
When a Signal Forms model bound to a text input is set to `null`, the value
is silently coerced to an empty string.

(cherry picked from commit 37f3279fe7)
2026-07-15 12:01:17 -07:00
Doug Parker 5936ffb80c refactor(core): update WebMCP tool registration to be asynchronous
In the latest WebMCP specification and Chromium preview builds, `document.modelContext.registerTool` was updated to be asynchronous and return a `Promise`: https://groups.google.com/a/chromium.org/g/chrome-ai-dev-preview/c/xQWt0b1sZIE/m/UJznbNCIAwAJ?utm_medium=email&utm_source=footer

This commit update adjusts Angular's experimental WebMCP implementation (`declareExperimentalWebMcpTool` and form registration) to be async as well, returning `Promise<void>`.

(cherry picked from commit f908140d71)
2026-07-10 10:56:45 -07:00
Bhuvansh855 5d06fcb109 test(forms): register writeback test control as CVA
Register the custom writeback test control as an NG_VALUE_ACCESSOR
so it is recognized as a valid formField host during debounce
writeback testing.

(cherry picked from commit 12fe700ad8)
2026-07-09 12:29:11 -07:00
Bhuvansh855 6cf7446afa fix(forms): prevent stale CVA writeback during debounce
Use controlValue() instead of value() when synchronizing
ControlValueAccessor instances.

When debounce is active, value() can still contain the
previous model value while controlValue() reflects the
latest user-entered value. This prevents stale values
from being written back to the CVA before the debounce
is flushed.

Adds a regression test covering the debounce scenario.

(cherry picked from commit 2e0cb52dbf)
2026-07-09 12:29:10 -07:00
Matthieu Riegler 1b9964675f fix(forms): allow multiple async validators
When a parent form element defines an async validator, its resource's `params` function needs to evaluate `syncValid()`, which causes unvisited child form nodes to be lazily instantiated. If any of these lazily instantiated child nodes also define an async validator, their resource is initialized while the parent's `params` function is still evaluating. This incorrectly triggers Angular core's `NG0992` guard (`Cannot create a resource inside the params of another resource`).
This commit exports `ɵsetInParamsFunction` and `ɵisInParamsFunction` from `@angular/core` and uses them in `FieldMetadataState.runMetadataCreateLifecycle` to explicitly detach the lazy creation of form metadata from the parent's reactive `params` context.

fixes #69620

(cherry picked from commit 5cb8c733a3)
2026-07-09 09:55:33 -07:00
volkanfilazi eca3395019 removed console log
(cherry picked from commit 8e8c5524bb)
2026-07-08 11:23:05 -07:00
volkanfilazi 171669f7b2 fix(forms/signals): make extractValue reactive for compat AbstractControl values
(cherry picked from commit b542302a23)
2026-07-08 11:23:05 -07:00
Matthieu Riegler ad3693f44f docs(forms): add jsdoc for ReadonlyFieldState
(cherry picked from commit d93e922517)
2026-07-08 10:45:36 -07:00
SkyZeroZx 748faa4f95 docs(docs-infra): Add build-time validation for API and guide links using route manifest
Adds build-time validation to catch broken, stale, or miscased internal documentation links in both JSDoc and markdown, including `/api/` and `/guide/` URLs and their fragments. Updates the documentation pipeline to share the canonical route manifest, ensuring that all references are checked against the current navigation structure.

(cherry picked from commit c1829f6d7c)
2026-07-08 10:24:51 -07:00
arturovt 3ac3753cd9 refactor(forms): avoid unnecessary Set allocation in maybeRemoveStaleArrayFields
Three small, behavior-neutral cleanups to maybeRemoveStaleArrayFields:

1. Avoid allocating an empty Set when prevData.byTrackingKey is
   undefined. new Set(undefined) previously created an unused empty
   Set on every call for parents with no tracking keys.

2. Guard the per-element tracking-key check on `oldTracking` being
   defined, skipping the isObject/hasOwn check entirely when there's
   nothing to track.

3. Replace childValue.hasOwnProperty(identitySymbol) with
   Object.hasOwn(childValue, identitySymbol). hasOwnProperty throws
   on null-prototype array elements (Object.create(null)), which
   would crash computeChildrenMap. Object.hasOwn is null-prototype-safe
   and preserves "own property" semantics (does not match inherited
   identitySymbol values).

4. Replace `data.byTrackingKey?.delete(id)` with
   `data.byTrackingKey!.delete(id)`. The optional chaining was dead:
   if oldTracking.size > 0, prevData.byTrackingKey (and therefore
   data.byTrackingKey, same Map reference via the spread) is always
   defined. The `?.` masked this invariant; `!` documents it and
   would surface a runtime error instead of a silent no-op if the
   invariant is ever violated.

Verified via performance.mark/measure instrumented directly inside
the function (count=1 call for a single-field edit in both cases).
Total duration dropped from ~0.7ms to ~0.1ms, consistent with the
avoided Set allocation in (1) and (2).

(cherry picked from commit 73ab88e65b)
2026-07-07 09:51:48 -07:00
Shuaib Hasan Akib c1a951aac3 refactor(forms): improve type safety of RadioControlRegistry._accessors
Replace `any[]` with `[NgControl, RadioControlValueAccessor][]` for the
private `_accessors` field in `RadioControlRegistry`. This aligns the
field type with how it is used in `add()`, `remove()`, `select()`, and
`_isSameGroup()`, which already typed its parameter as
`[NgControl, RadioControlValueAccessor]`.

(cherry picked from commit 0285f558f9)
2026-07-06 13:59:21 -07:00
SkyZeroZx 8cedaecca8 docs: add @see references to Signal Forms
(cherry picked from commit bbbcf8fc7f)
2026-07-06 13:35:24 -07:00
Matthieu Riegler 2353bf22a5 refactor(forms): widen AsyncValidatorOptions.factory
This is to accept `Resource` and not only `ResourceRef`.

fixes #69443

(cherry picked from commit 63c7ac325d)
2026-06-24 13:03:41 -04:00
Kam d2b613900c docs(forms): clarify debounce('blur') usage with custom FormValueControl
A custom FormValueControl only participates in debounce('blur') if it emits
the touch output on the native blur event. This was undocumented, and the
touch name reads like a focus event, so users wired it to (focus) and
blur-based debouncing silently did nothing.

Add a dedicated guide section with a working example, link the debounce API
reference to it, and clarify the touch JSDoc that it must fire on blur, not
focus.

Fixes #69370

(cherry picked from commit 12fcec8ce9)
2026-06-24 11:38:52 -04:00
Kam 59ee51e2d4 docs(forms): update package docs for Signal Forms graduation
After #68581 graduated the Signal Forms APIs to public API and #68654 removed
the experimental warnings from the Signal Forms documentation in adev, the
package READMEs still framed the API as experimental.

Update `packages/forms/signals/PACKAGE.md`: drop the experimental title and
intro, remove the now-shipped entries from "Not yet supported" (interop with
reactive/template forms and strongly-typed binding to UI controls), and remove
the remaining experimental and exploratory wording from the FAQ.

Update `packages/forms/PACKAGE.md`: it listed only two ways to build forms
(reactive and template-driven). Add signal forms as the third.

Fixes #68724

(cherry picked from commit 8b1726a1cf)
2026-06-22 16:29:22 -04:00
Andrew Scott 3f055435f6 refactor(forms): fix initWebMcpForm description to be required
updates from breakage in https://github.com/angular/angular/commit/c121407c0da2456543a54822941d71a75490b703

(cherry picked from commit a7e7a2cf05)
2026-06-10 17:51:20 +00:00
Matthieu Riegler 11836a670a fix(forms): delay mcp reading the form model by a tick
Reading the form model on init is unsafe as it could depend on inputs (eg a required input). We need to delay the read by a tick (after the inputs are set) to ensure that values can be safely read.

fixes #69262

(cherry picked from commit 9604ecfd8b)
2026-06-10 17:14:45 +00:00
arturovt e51ad374ea fix(forms): remove animationstart listener on component destroy to prevent memory leak
The `watchValidity` method in `AnimationInputValidityMonitor` was registering
an anonymous arrow function via `addEventListener` with no corresponding
`removeEventListener` call.

In V8, each closure is represented as a `JSFunction` holding a strong pointer
to a heap-allocated `Context` object containing captured variables
(`VariableLocation::CONTEXT` slots, decided at parse time by
`Scope::MustAllocateInContext`). In Blink, DOM event listeners are stored in
the element's `EventTargetData::event_listener_map` as `JSEventListener`
wrappers backed by a `v8::Persistent<JSFunction>` handle — a strong cross-heap
reference that keeps the function alive as long as the element is alive.

Because the callback passed to `watchValidity` closes over the calling
component/directive (which itself holds a reference back to the element), this
produced a cross-heap reference cycle:

```
  HTMLInputElement (Blink/Oilpan)
    └── EventTargetData → JSEventListener → v8::Persistent<JSFunction>
          └── Context → callback closure
                └── component → HTMLInputElement  ← cycle
```

Neither V8's nor Blink's GC could independently break this cycle because it
crosses the V8/Oilpan heap boundary. The element was therefore never collected
after being removed from the DOM.

The fix stores the listener in a named local variable and registers its removal
via `DestroyRef.onDestroy`, tying cleanup to the lifetime of the component that
owns the element. This ensures `removeEventListener` is called with the exact
same `JSFunction` reference, causing Blink to drop the `v8::Persistent` handle
and allowing both the function and the element to become GC-eligible.

(cherry picked from commit 6cc54e5ede)
2026-06-10 16:56:20 +00:00
Matthieu Riegler 85d2d100e3 fix(forms): harden FormGroup control lookups against prototype shadowing
Guard FormGroup control-map presence checks with safe own-property checks to avoid inherited/prototype collisions from reserved keys such as hasOwnProperty and toString.

This prevents:
- crashes from shadowed hasOwnProperty access paths
- incorrect early-return and existence behavior for prototype-named controls

Adds regression tests for prototype-shadowed keys covering:
- register/add with toString
- contains/get with hasOwnProperty
- setControl/removeControl with toString
- FormRecord behavior with hasOwnProperty

(cherry picked from commit f06b96d181)
2026-06-10 02:28:00 +00:00
cexbrayat cdcea80327 fix(core): require WebMCP tool descriptions
The WebMCP ModelContextTool dictionary marks description as required: https://webmachinelearning.github.io/webmcp/#modelcontexttool-dictionary

(cherry picked from commit c121407c0d)
2026-06-09 10:29:15 -07:00
Doug Parker 55b7b5a6b6 fix(forms): set additionalProperties: false on generated WebMCP form
This tells the agent that all input properties have been explicitly declared and that it should not attempt to specify additional arguments with unknown names. This provides a little more safety and gives the AI a little more information about the allowed set of inputs for this tool.

(cherry picked from commit df77e42327)
2026-06-04 21:18:10 +00:00
cexbrayat e81c7e8466 refactor(forms): type built-in getError results
Add overloads for built-in validation error keys so callers get precise error payload types from getError.

This enables signal forms template patterns like:

```html
@if (login.getError('minLength'); as minLengthError) {
  <div>Login should be {{ minLengthError.minLength }} characters</div>
}
```

(cherry picked from commit 45e8fb5d6c)
2026-05-29 14:58:47 +02:00
cexbrayat eb600aa3b2 refactor(forms): mark date and limit signal forms APIs public
Promote the signal forms date validator and limit metadata APIs from experimental to public API.

(cherry picked from commit 842cf8f31b)
2026-05-27 11:16:25 -07:00
Alan Agius a97d5ec22d build: update minimum supported Node.js versions
Update the minimum supported Node.js versions for v22 and v24. Specifically, the minimum supported version for Node.js v22 is bumped to v22.22.3, and for v24 it is bumped to v24.15.0. This ensures compatibility with newer runtime versions and coordinates ranges across monorepo packages.

(cherry picked from commit 861d37e669)
2026-05-27 10:39:21 -07:00
arturovt 3b4ef1e2ff perf(forms): avoid redundant invalidations in parser errors signal
The `errors` linkedSignal in `createParser` had no equality check, so
every reset or recomputation — even to an identical empty array — would
mark downstream dependents as dirty and trigger unnecessary re-renders.

Add `shallowArrayEquals` as the equality function so the signal only
notifies dependents when the error list actually changes.

(cherry picked from commit 1563aae118)
2026-05-21 10:57:55 -07:00
arturovt 16cf84d953 docs: document FormBuilder.group() controlsConfig value shapes
The `@param` JSDoc for `FormBuilder.group()` previously described the argument only as “a collection of child controls”, without explaining the four supported value shapes:

* a raw value
* a `FormControlState`
* a `ControlConfig` tuple
* a pre-built `AbstractControl`

The fact that the second element of a `ControlConfig` tuple can accept `AbstractControlOptions` (for example to configure per-control `updateOn`) was especially non-obvious and undocumented.

This change adds a `@usageNotes` section with concrete examples covering each supported shape.

Closes #43984

(cherry picked from commit 3b8503f960)
2026-05-20 14:08:00 -07:00
arturovt 07a9358157 perf(forms): avoid spurious recomputation in FormField.parseErrors
`parseErrors` in `FormField` always produced a new array on every recomputation, even when nothing actually changed. The `?? []` fallback created a new empty array whenever `parseErrorsSource` was undefined, and `.map()` also returned new object references each time.

Since computed signals use reference equality by default, those new arrays were treated as changed values. That caused unnecessary updates to propagate through `validationState.parseErrors` and the combined errors chain, triggering extra recomputations during change detection.

Fix this by adding `{equal: shallowArrayEquals}` to the `parseErrors` computed, matching the existing `errors` computed and the validation computeds in `field/validation.ts`.

This prevents empty arrays from triggering updates while still correctly propagating real parse-error changes.

(cherry picked from commit f43bad4d7b)
2026-05-18 13:08:37 -07:00
Douglas Parker da82f24330 refactor(forms): add provideExperimentalWebMcpForms
This enables the use of the `experimentalWebMcpTool` option on signal forms and implicitly declares a WebMCP tool based on the form data model. This is an experiment inspirted by the WebMCP declarative forms API to see if Angular's framework-level knowledge of the form's declarative data model can produce higher quality WebMCP tools than the web standard can on its own with less effort from the developer.

Example:

```typescript
// main.ts

import {bootstrapApplication} from '@angular/platform-browser';
import {provideExperimentalWebMcpForms} from '@angular/forms';
import {MyComp} from './form';

bootstrapApplication(MyComp, {
  providers: [
    // Activate the feature.
    provideExperimentalWebMcpForms(),
  ],
});
```

```typescript
// form.ts

import {Component, signal} from '@angular/core';
import {form} from '@angular/forms';

@Component({ /* ... */ })
export class MyComp {
  private readonly f = form(signal({
    firstName: '',
    lastName: '',
  }), {
    // Implicitly creates a WebMCP tool named `createUser` which accepts a `firstName` and `lastName` as parameters.
    experimentalWebMcpTool: {
      name: 'createUser',
      description: 'Creates a user with the given name.',
    },

    // Invokes the submit action when the agent calls the WebMCP tool.
    submission: {
      action: () => {
        console.log('User clicked submit, or agent called the tool!');
      },
    },
  });

  // ...
}
```
2026-05-15 12:10:55 -07:00
Matthieu Riegler ad717dff1d refactor(core): use the @Service decorator where possible.
A few bytes to win.
Added only on the services that don't rely on constructor DI.

(cherry picked from commit a7dab601fa)
2026-05-07 16:03:34 -07:00
kirjs 043055f6de refactor(forms): support when consistently for maxDate and minDate validators
This commit updates maxDate and minDate to consistently check and apply the 'when' option for conditional validation.
2026-05-06 14:10:12 -07:00
kirjs 0806b2f02b refactor(forms): use overloads and JSDoc for deprecations
This commit removes runtime console warnings and uses TypeScript overloads with JSDoc @deprecated annotations to handle backward compatibility for conditional rules.
2026-05-06 14:10:12 -07:00
kirjs 7d9862f0be refactor(forms): support deprecated signatures for backward compatibility
This commit restores support for passing functions directly to hidden, disabled, and readonly rules, marking them as deprecated.
2026-05-06 14:10:12 -07:00
kirjs df54e6a7b2 refactor(forms): use when consistently for conditional rules and validators
This commit updates the signal forms API to use a consistent 'when' parameter for conditional rules and validators, replacing direct function arguments.
2026-05-06 14:10:12 -07:00
Alex Rickabaugh 7745365910 feat(forms): graduate signal forms APIs to public API
Replaced `@experimental` tags with `@publicApi 22.0` across all Signal Forms APIs under `packages/forms/signals` to mark them as ready for general use in v22.

TAG=agy
CONV=0af6c644-225a-4212-a49a-5843d17ec638
2026-05-06 12:01:41 -07:00
Leon Senft 1f30aacbe5 refactor(forms): bind formatted date string to min/max for minDate/maxDate (#68001)
* Test that `minDate`/`maxDate` binds to `min`/`max` on date and time inputs
* Test that `min`/`max` attribute can be set directly on date and time inputs
* Relax type checker to allow `min`/`max` bindings on date and time inputs

PR Close #68001
2026-05-06 11:59:18 -07:00
Leon Senft 276c917b34 refactor(forms): add validation rules for date constraints (#68001)
- Added `minDate()` and `maxDate()` for validating constraints on `Date` inputs.
- `ReadonlyFieldState.min` and `.max` now return
  `Signal<NonNullable<TValue>`. This ensures that `min` and `max` inputs
  on custom controls can accept a reliable type (matching their value
  type).
- Made the `TWrite` type parameter of `MetadataKey` contravariant to
  properly indicate that it's writable.
- Added `LimitKey` as a convenience type for defining validation limit
  metadata (e.g. `MAX_NUMBER`, `MIN_DATE`).
- Added `LimitSelectionKey` which can be used to bind a `LimitKey` with
  value-specific aggregation logic, to a generic metadata key (e.g. use
  `MAX_NUMBER` to aggregate numbers for `MAX`).

PR Close #68001
2026-05-06 11:59:18 -07:00
Leon Senft 592a12d6c9 refactor(forms): remove string support from min and max validation rules (#68001)
The `min` and `max` validation rules previously handled `string` values
to accommodate numbers bound to text inputs. However, this is no longer
necessary as the control binding itself handles the conversion.

This change removes string support from these rules, simplifying the
types to `number | null`. The validation logic has been updated to use
concrete checks (`value === null || Number.isNaN(value)`) to ensure safe
TypeScript narrowing.

Associated tests have been updated to:
- Remove string-specific validation checks.
- Add coverage for text input bindings.
- Add coverage for empty input handling (standard behavior where empty
  sets model to null and skips validation).

BREAKING CHANGE: `min` and `max` validation rules no longer support
string values. Bound values must be numbers or null.

PR Close #68001
2026-05-06 11:59:18 -07:00
Alex Rickabaugh 849dba6c65 fix(forms): implement custom control reset propagation
Introduce a highly decoupled FVC and CVA custom control reset mechanism, and implement the framework-wide automatic `transformedValue` and native controls clearing bridge for both new Signal Forms and legacy forms (Template-driven and Reactive).

1. Custom Control Reset Propagation (Bug #2):
- Establish agnostic custom control resetting via `FormFieldBindingOptions.reset` in `FormField`.
- Ensure that `FieldNode.reset()` unconditionally triggers `writeValue` updates on CVA custom controls.
- Protect against duplicate writes during subsequent change detection updates in `control_cva.ts` by verifying and tracking previous written values in the local bindings cache.

2. Unified Framework-wide FormControl Integration:
- Introduce a monorepo-wide private InjectionToken `ɵFORM_CONTROL_INTEGRATION` and `ɵFormControlIntegration` interface to act as the single, decoupled bridge for hooking up FVC parse errors and receiving control resets across both Signal and legacy forms architectures.
- Simplify Signal Forms: make `FormField` implements `ɵFormControlIntegration` directly, removing the intermediate context object and reducing DI boilerplate down to a clean `useExisting: FormField` provider. Triggers the `onReset` callback directly inside `FormField.reset()`.
- Upgrade Legacy Forms: `NG_CONTROL_INTEGRATION_PROVIDER` provides the renamed token. `NgControl` handles the event subscription internally (`set onReset(callback)`) to recursively listen to `control.events` (`FormResetEvent`) lazily only when assigned, resolving all `FormControl` swapping timing and lifecycle cleanup races automatically.

3. Automatic `transformedValue` and Native Controls Utility Clearing:
- Make `Parser.reset()` method required in the interface for a cleaner and non-defensive execution.
- Wire `transformedValue` into the new integration token `ɵFORM_CONTROL_INTEGRATION` to clear validation parsing states on resets.
- Lazily resets the UI-facing `rawValue` linked signal utilizing the original native `linkedSignal.set` callback (`originalSet`), correctly bypassing the UI-to-model parser loopback and preventing redundant model writes during `reset()`.
- Wire up Native Controls (`control_native.ts\Device`): Hook `parent.onReset` inside native element creation to automatically trigger the native `parser.reset()` and force DOM writes (`setNativeControlValue`) back down to the DOM input value during resets, ensuring native elements with pending parsing validation errors are successfully cleared and synced on form resets.

TAG=agy
CONV=8b4cee1e-2117-42a4-b242-c8ec7bf01752
2026-05-06 10:45:40 -07:00
Suraj Yadav 68c3abbe09 fix(forms): synchronize controls with the model on reset
Synchronize `controlValue` with the model `value` following `reset()`. This
ensures the UI will reflect the form model in cases where a control had a
pending change–delayed by debouncing–at the time it was reset.
2026-05-06 10:45:40 -07:00
Alan Agius b8d3f36ed9 feat(compiler-cli): add support for Node.js 26.0.0
Updates the supported Node.js engine versions to include Node.js 26.

This allows running the CLI on Node.js 26.0.0 and above while continuing to support active LTS versions.
2026-05-06 09:55:38 -07:00
Matthieu Riegler 3524de29f3 fix(forms): Add support for range type with outside of native bounds
range inputs don't allow value that are outside their min/max ranges.

fixes #68480
2026-05-05 16:26:03 -07:00
Alex Rickabaugh 5835a5e3a7 fix(forms): prevent orphan field crashes in debounceSync and async validation
- Short-circuit `FieldNode.debounceSync()` if the node is orphaned right
  before calling `this.sync()`, preventing unhandled promise rejections
  on dead state reads.
- Include `this.node.structure.isOrphaned()` in `shouldSkipValidation`
  computed signal in `ValidationState`. This safely shields the entire
  validation layer (sync and async errors) from executing on dead nodes during
  in-flight async validator resolutions.
- Append robust reproduction specs to `orphan_repro.spec.ts` for both the
  `debounceSync` and `validateAsync` async race conditions. Include an intentional
  promise resolution workaround for an experimental Angular `core/resource`
  `PendingTasks` leak deadlock bug uncovered during testing.

TAG=agy
CONV=054e0185-f5f0-40e3-9c9b-413309f36cf6
2026-05-05 15:54:42 -07:00
Alex Rickabaugh 3c44d7c90b fix(forms): fix orphan field error on blur during array removal
Explain the race condition: when an item is deleted from a model array, its
DOM element is removed during change detection, which fires a `blur` event
synchronously. The `blur` handler tries to mark the field as touched,
navigating up to `keyInParent` which throws because the item is already gone
from the array in signals state.

Fix by introducing an `isOrphaned` check that short-circuits `markAsTouched`
early, backed by a reactivity-insulated `childrenMap` poll to avoid double
scans and prevent unhandled exceptions.

TAG=agy
CONV=054e0185-f5f0-40e3-9c9b-413309f36cf6

Fixes #66711

Co-Authored-By: Matthieu Riegler <kyro38@gmail.com>
2026-05-05 15:54:42 -07:00
Leon Senft 708631f2c4 fix(forms): prohibit concurrent submits in signal forms
Prohibit concurrent submits in signal forms to prevent duplicate actions and side effects when a submission is already in progress.

If `submit()` is called while a prior submit is in progress for the same field or any of its parents, it returns `false` immediately without running the action again.

This commit also updates the documentation in `form-submission.md` to reflect this behavior.

Fixes #68317
2026-05-05 11:14:03 -07:00