Skip to content

fix(forms): prevent stale CVA writeback during debounce#69436

Open
BHUVANSH855 wants to merge 2 commits into
angular:mainfrom
BHUVANSH855:fix-69387-signal-forms-debounce
Open

fix(forms): prevent stale CVA writeback during debounce#69436
BHUVANSH855 wants to merge 2 commits into
angular:mainfrom
BHUVANSH855:fix-69387-signal-forms-debounce

Conversation

@BHUVANSH855

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When a Signal Forms field uses debounce(), ControlValueAccessor synchronization reads from fieldState.value(). During the debounce period, this value can still contain the previous model value even though the control has already received a newer user-entered value.

As a result, the stale model value may be written back to the CVA before the debounced update is flushed.

Issue Number: #69387

What is the new behavior?

ControlValueAccessor synchronization now uses fieldState.controlValue() instead of fieldState.value().

This ensures that CVAs receive the latest control value while a debounce is pending, preventing stale values from being written back to the control.

A regression test has been added to verify that no stale write-back occurs when debounce is active.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The change aligns CVA synchronization behavior with the existing implementations in control_custom.ts and control_native.ts, which already use controlValue().

@pullapprove pullapprove Bot requested a review from JeanMeche June 19, 2026 07:13
@ngbot ngbot Bot added this to the Backlog milestone Jun 19, 2026
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.
@BHUVANSH855 BHUVANSH855 force-pushed the fix-69387-signal-forms-debounce branch from bd22f2f to 49c0547 Compare June 19, 2026 13:03
Register the custom writeback test control as an NG_VALUE_ACCESSOR
so it is recognized as a valid formField host during debounce
writeback testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant