Skip to content

Signal Forms: parse errors are lost when parse() returns both value and errors #67170

@cexbrayat

Description

@cexbrayat

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

forms

Is this a regression?

Yes

Description

In Signal Forms, parse errors can be dropped when a custom control uses transformedValue and parse() returns both a parsed value and errors in the same result.

This affects scenarios like validation during parsing (for example returning a numeric value but also emitting a max/min style parse error).

If parse() returns { value, errors }, both should be preserved. In rc.0 the value updates, but errors are cleared and do not appear on field.errors().

To repro, create a custom FormValueControl<number | null> using transformedValue with:

parse: (raw) => {
  const value = Number(raw);
  if (Number.isNaN(value)) return { errors: [{ kind: 'parse' }] };
  if (value > 10) return { value, errors: [maxError(10)] };
  return { value };
}

When entering 11, the field value updates, but field.errors() is empty (expected a max error).

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


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

Angular CLI       : 21.2.0-rc.0
Angular           : 21.2.0-rc.0
Node.js           : 22.22.0
Package Manager   : npm 10.9.0
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/cli              │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/common           │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/compiler         │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/compiler-cli     │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/core             │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/forms            │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/localize         │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/platform-browser │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ @angular/router           │ 21.2.0-rc.0       │ 21.2.0-rc.0       │
│ rxjs                      │ 7.8.2             │ 7.8.2             │
│ typescript                │ 5.9.3             │ 5.9.3             │
│ vitest                    │ 4.0.18            │ 4.0.18            │

Anything else?

This was working in next.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions