Skip to content

Signal forms: submit() runs the action before debounced child values are synced #71149

Closed

Description

@MeAkib

Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

When a child field uses debounce(), submitting the form can pass the action the child's old value instead of what the user typed.

submit() calls markAsTouched() on the form root. markAsTouched() flushes the pending debounced value only for the field it is called on. Descendants are marked as touched, but their pending values are not flushed.

This shows up when the user presses Enter inside a debounced input. The input keeps focus, so the value is still pending when the action runs. Clicking a submit button hides the bug, because the click blurs the input and flushes its value first.

readonly profileForm = form(
  this.model,
  (p) => {
    debounce(p.name, 'blur');
  },
  {
    submission: {
      action: async (f) => {
        console.log(f.name().value()); // "" after typing "Ada" and pressing Enter
      },
    },
  },
);
<form [formRoot]="profileForm">
  <input [formField]="profileForm.name" />
  <button type="submit">Submit</button>
</form>

Steps:

  1. Type "Ada" in the input.
  2. Press Enter while the input still has focus.

Expected: the action receives "Ada".
Actual: the action receives "", and the model still holds "".

A duration debounce such as debounce(p.name, 500) has the same problem if Enter is pressed before the duration elapses.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-b1x3y5vd?file=package.json

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI       : 22.2.1
Angular           : 22.2.1
Node.js           : 22.22.3
Package Manager   : npm 10.8.2
Operating System  : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 22.2.1            │ ^22.2.0           │
│ @angular/cli              │ 22.2.1            │ ^22.2.0           │
│ @angular/common           │ 22.2.1            │ 22.2.1            │
│ @angular/compiler         │ 22.2.1            │ 22.2.1            │
│ @angular/compiler-cli     │ 22.2.1            │ 22.2.1            │
│ @angular/core             │ 22.2.1            │ 22.2.1            │
│ @angular/forms            │ 22.2.1            │ 22.2.1            │
│ @angular/platform-browser │ 22.2.1            │ 22.2.1            │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 6.0.3             │ ~6.0.0            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else?

No response

Activity

  1. added this to the needsTriage milestone on Oct 3, 2026
  2. added this to the needsTriage milestone on Oct 3, 2026
  3. added 4 commits that reference this issue on Oct 24, 2026
    b9d0f13
    38a1a94
    f71725a
    a55a545
  4. added a commit that references this issue on Nov 11, 2026
    22acaf1
  5. added a commit that references this issue on Nov 11, 2026
    5b66fb4
  6. added a commit that references this issue on Nov 11, 2026
    cf37344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions