Title: Reactive forms: transformedValue control shows an empty value after reset() followed by setting the previous value · Issue #72068 · angular/angular · GitHub
Open Graph Title: Reactive forms: transformedValue control shows an empty value after reset() followed by setting the previous value · Issue #72068 · angular/angular
X Title: Reactive forms: transformedValue control shows an empty value after reset() followed by setting the previous value · Issue #72068 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? No Description A FormValueControl that uses transformedValue shows an empty input after a reactive form is reset and then set back to the value it had bef...
Open Graph Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? No Description A FormValueControl that uses transformedValue shows an empty input after a reactive form is reset a...
X Description: Which @angular/* package(s) are the source of the bug? forms Is this a regression? No Description A FormValueControl that uses transformedValue shows an empty input after a reactive form is reset a...
Opengraph URL: https://github.com/angular/angular/issues/72068
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reactive forms: transformedValue control shows an empty value after reset() followed by setting the previous value","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nforms\n\n### Is this a regression?\n\nNo\n\n### Description\n\nA `FormValueControl` that uses `transformedValue` shows an empty input after a reactive form is reset and then set back to the value it had before the reset, in the same tick.\n\n```ts\nimport { ChangeDetectionStrategy, Component, model } from '@angular/core';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { FormValueControl, transformedValue } from '@angular/forms/signals';\nimport { bootstrapApplication } from '@angular/platform-browser';\n\n@Component({\n selector: 'app-text-input',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\u003cinput [value]=\"rawValue()\" (input)=\"rawValue.set($any($event.target).value)\" />`,\n})\nexport class TextInput implements FormValueControl\u003cstring | null> {\n readonly value = model\u003cstring | null>(null);\n protected readonly rawValue = transformedValue(this.value, {\n parse: (raw: string) => ({ value: raw || null }),\n format: (value: string | null) => value ?? '',\n });\n}\n\n@Component({\n selector: 'app-root',\n imports: [ReactiveFormsModule, TextInput],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n \u003cform [formGroup]=\"form\">\n \u003capp-text-input formControlName=\"name\" />\n \u003cinput formControlName=\"name\" />\n \u003c/form>\n \u003cbutton (click)=\"reload()\">reset + patchValue (same value)\u003c/button>\n \u003cp>Control value: \"{{ form.value.name }}\"\u003c/p>\n `,\n})\nexport class App {\n protected readonly form = new FormGroup({ name: new FormControl\u003cstring | null>('Ada') });\n\n protected reload(): void {\n this.form.reset();\n this.form.patchValue({ name: 'Ada' });\n }\n}\n\nbootstrapApplication(App);\n```\n\nClick the button. The native input and the control value still show \"Ada\", but the custom input is empty. If change detection runs between `reset()` and `patchValue()`, everything stays in sync.\n\n#### Cause\n\nThe reset propagation added in 849dba6 updates the raw value without updating the model or the cache of the last value written to the control:\n\n1. On `FormResetEvent`, `NgControl` calls the reset callback with `control.value`, which is `null` here ([ng_control.ts](https://github.com/angular/angular/blob/1e6afa4cb84c/packages/forms/src/directives/ng_control.ts#L89-L103)).\n2. `transformedValue` writes `format(null)` into its raw-value `linkedSignal` with `originalSet`, bypassing the model on purpose ([transformed_value.ts](https://github.com/angular/angular/blob/1e6afa4cb84c/packages/forms/signals/src/api/transformed_value.ts#L140-L144)). The control's `value` model is still `'Ada'`, because `NgControl` only writes it during change detection.\n3. `patchValue({name: 'Ada'})` sets the `FormControl` back to `'Ada'`.\n4. During change detection, `ngControlUpdate` skips the write because `customControlBindings.value` is still `'Ada'` ([ng_control.ts](https://github.com/angular/angular/blob/1e6afa4cb84c/packages/forms/src/directives/ng_control.ts#L381-L387)). The model never changes, so the `linkedSignal` never recomputes and keeps the empty raw value.\n\nThe same commit handles this for CVA controls under `[formField]`: the `reset` binding in `control_cva.ts` writes the value and updates `bindings['controlValue']`, so later updates are compared against what the control really holds. The FVC path under `NgControl` has no equivalent.\n\n#### Proposed fix\n\nMirror the CVA reset in `NgControl`. On `FormResetEvent`, before calling the reset callback, `NgControl` should write the reset value to the custom control's `value` model and update `customControlBindings.value` to match. Any pending custom value (for `updateOn: 'blur'` or `'submit'`) should be discarded at the same time, as `ngControlUpdate` already does when it overwrites the control.\n\nThe model has to be written during the reset, not on the next change detection. If the write is deferred, `transformedValue` still formats the reset value while the model holds the old one, and when the previous value is written back the model doesn't change, so the raw value is never recomputed.\n\n### Please provide a link to a minimal reproduction of the bug\n\nThe example in the description is a complete `src/main.ts`: paste it into a new Angular 22 project (for example `ng new --minimal`) and run `ng serve`.\n\n### Please provide the exception or error you saw\n\nNo errors\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI : 22.2.7\nAngular : 22.2.6\nNode.js : 22.23.3\nPackage Manager : yarn 1.22.22\nOperating System : win32 x64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/build │ 22.2.7 │ 22.2.7 │\n│ @angular/cli │ 22.2.7 │ 22.2.7 │\n│ @angular/common │ 22.2.6 │ 22.2.6 │\n│ @angular/compiler │ 22.2.6 │ 22.2.6 │\n│ @angular/compiler-cli │ 22.2.6 │ 22.2.6 │\n│ @angular/core │ 22.2.6 │ 22.2.6 │\n│ @angular/forms │ 22.2.6 │ 22.2.6 │\n│ @angular/platform-browser │ 22.2.6 │ 22.2.6 │\n│ rxjs │ 7.8.2 │ 7.8.2 │\n│ typescript │ 6.0.3 │ ~6.0.3 │\n└───────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else?\n\n#72065 looks related but is a different problem: there the control writes its own model under `[formField]`, and the remembered value in `control_custom.ts` is not updated. Here the control's model is never written; only the raw value of `transformedValue` is.\n","author":{"url":"https://github.com/itsokto","@type":"Person","name":"itsokto"},"datePublished":"2026-11-16T21:04:27Z","url":"https://github.com/angular/angular/issues/72068"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f7d9bc4a-19d3-c5c7-3c58-6e5b2ab5d117 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B912:97D39:761030:9C280B:6B01DB78 |
| html-safe-nonce | 9acd2ef0377b8186a242a5ece347371877145b3beab95c9589da34d96da07031 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTEyOjk3RDM5Ojc2MTAzMDo5QzI4MEI6NkIwMURCNzgiLCJ2aXNpdG9yX2lkIjoiMjgwNTEwNTI3ODEwNDc1NTA2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 63dcc69d5e7f473b02616225fe4be5c213c22bc5dc112e1b091cffe90ebec202 |
| hovercard-subject-tag | issue:6430752441 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/72068/issue_layout |
| twitter:image | https://opengraph.githubassets.com/52119753ff586c132cc689f40f2bff59e1215403d687ddc24c1142c0a32f36bb/angular/angular/issues/72068 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/52119753ff586c132cc689f40f2bff59e1215403d687ddc24c1142c0a32f36bb/angular/angular/issues/72068 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? forms Is this a regression? No Description A FormValueControl that uses transformedValue shows an empty input after a reactive form is reset a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | itsokto |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width