mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Introduce a highly decoupled FVC and CVA custom control reset mechanism, and implement the framework-wide automatic `transformedValue` and native controls clearing bridge for both new Signal Forms and legacy forms (Template-driven and Reactive). 1. Custom Control Reset Propagation (Bug #2): - Establish agnostic custom control resetting via `FormFieldBindingOptions.reset` in `FormField`. - Ensure that `FieldNode.reset()` unconditionally triggers `writeValue` updates on CVA custom controls. - Protect against duplicate writes during subsequent change detection updates in `control_cva.ts` by verifying and tracking previous written values in the local bindings cache. 2. Unified Framework-wide FormControl Integration: - Introduce a monorepo-wide private InjectionToken `ɵFORM_CONTROL_INTEGRATION` and `ɵFormControlIntegration` interface to act as the single, decoupled bridge for hooking up FVC parse errors and receiving control resets across both Signal and legacy forms architectures. - Simplify Signal Forms: make `FormField` implements `ɵFormControlIntegration` directly, removing the intermediate context object and reducing DI boilerplate down to a clean `useExisting: FormField` provider. Triggers the `onReset` callback directly inside `FormField.reset()`. - Upgrade Legacy Forms: `NG_CONTROL_INTEGRATION_PROVIDER` provides the renamed token. `NgControl` handles the event subscription internally (`set onReset(callback)`) to recursively listen to `control.events` (`FormResetEvent`) lazily only when assigned, resolving all `FormControl` swapping timing and lifecycle cleanup races automatically. 3. Automatic `transformedValue` and Native Controls Utility Clearing: - Make `Parser.reset()` method required in the interface for a cleaner and non-defensive execution. - Wire `transformedValue` into the new integration token `ɵFORM_CONTROL_INTEGRATION` to clear validation parsing states on resets. - Lazily resets the UI-facing `rawValue` linked signal utilizing the original native `linkedSignal.set` callback (`originalSet`), correctly bypassing the UI-to-model parser loopback and preventing redundant model writes during `reset()`. - Wire up Native Controls (`control_native.ts\Device`): Hook `parent.onReset` inside native element creation to automatically trigger the native `parser.reset()` and force DOM writes (`setNativeControlValue`) back down to the DOM input value during resets, ensuring native elements with pending parsing validation errors are successfully cleared and synced on form resets. TAG=agy CONV=8b4cee1e-2117-42a4-b242-c8ec7bf01752 |
||
|---|---|---|
| .. | ||
| acceptance | ||
| animation | ||
| animation_utils | ||
| authoring | ||
| bundling | ||
| change_detection | ||
| compiler | ||
| debug | ||
| di | ||
| dom | ||
| hydration | ||
| i18n | ||
| legacy_animation | ||
| linker | ||
| metadata | ||
| reflection | ||
| render3 | ||
| resource | ||
| sanitization | ||
| signals | ||
| strict_types | ||
| testability | ||
| util | ||
| zone | ||
| application_config_spec.ts | ||
| application_init_spec.ts | ||
| application_module_spec.ts | ||
| application_ref_integration_spec.ts | ||
| application_ref_spec.ts | ||
| BUILD.bazel | ||
| change_detection_scheduler_spec.ts | ||
| component_fixture_spec.ts | ||
| defer_fixture_spec.ts | ||
| dev_mode_spec.ts | ||
| directive_lifecycle_integration_spec.ts | ||
| error_handler_spec.ts | ||
| event_emitter_spec.ts | ||
| fake_async_spec.ts | ||
| forward_ref_integration_spec.ts | ||
| runtime_error_spec.ts | ||
| test_bed_effect_spec.ts | ||
| test_bed_spec.ts | ||
| transfer_state_spec.ts | ||