fix(forms): ensure reset cancels pending debounce and syncs controlValue#68353
Open
surajy93 wants to merge 1 commit intoangular:mainfrom
Open
fix(forms): ensure reset cancels pending debounce and syncs controlValue#68353surajy93 wants to merge 1 commit intoangular:mainfrom
surajy93 wants to merge 1 commit intoangular:mainfrom
Conversation
leonsenft
requested changes
Apr 24, 2026
c8d3f5d to
dd94f36
Compare
leonsenft
requested changes
Apr 27, 2026
| }); | ||
| }); | ||
|
|
||
| describe('FieldNode._reset() unit tests', () => { |
Contributor
There was a problem hiding this comment.
The first two tests above are perfect–they test user visible behavior. 👍
While I appreciate the thoroughness, these remaining tests are only testing internal implementation details which we explicitly do not want to do. For example, it's possible we refactor the internals such that the observable behavior is unchanged, but now these tests fail.
Contributor
Author
There was a problem hiding this comment.
Good point, thanks for the feedback! Removed the FieldNode._reset() unit tests block.
The two behavioral tests covering the debounce scenarios (promise-based and blur-based) are still in place.
Abort any pending debounce before resetting to prevent stale sync() from overwriting the reset value. Force controlValue to match value during reset, even when the value has not changed, ensuring the UI does not retain stale user input. markAsDirty() triggered by controlValue.set() is neutralized by markAsPristine(), and no unnecessary sync is triggered since values are already aligned.
dd94f36 to
ef3b6ca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Abort any pending debounce before resetting to prevent stale sync() from overwriting the reset value.
Force controlValue to match value during reset, even when the value has not changed, ensuring the UI does not retain stale user input.
markAsDirty() triggered by controlValue.set() is neutralized by markAsPristine(), and no unnecessary sync is triggered since values are already aligned.
Fixes: #68076
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #68076
What is the new behavior?
Does this PR introduce a breaking change?
Other information