component implements ControlValueAccessor still connected to ngForm after destroy
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/forms
Is this a regression?
I don’t know if this had work before.
Description
When a component implementing ControlValueAccessor is destroyed, writeValue is still called on patchValue for example. Destroy component multiple times results in multiple writeValue called
🔬 Minimal Reproduction
please try this stackblitz, click on [toggle input] button multiple times to create and destroy component and click on patch value button to see in console the console.log from writeValue https://stackblitz.com/edit/angular-pfmvxh
writeValue(obj: any): void {
console.log('writeValue', obj);
}
You should see one writeValue by component destroyed
🔥 Exception or Error
if detection strategyis set to OnPush and call ChangeDetectorRef.detectChanges() in writeValue we will raise a ViewDestroyedError that confirm that writeValue is called even component is destroyed
🌍 Your Environment
Angular Version:
@angular-devkit/architect 0.10.6
@angular-devkit/build-angular 0.10.6
@angular-devkit/build-optimizer 0.10.6
@angular-devkit/build-webpack 0.10.6
@angular-devkit/core 7.0.6
@angular-devkit/schematics 7.0.6
@angular/cdk 7.1.0
@angular/cli 7.0.6
@angular/material 7.1.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:11 (4 by maintainers)
Is there any fix or workaround for that bug?
Guys, the bot only locks already closed issues, it does not close open issues due to inactivity. There’s a bunch of people receiving emails for every comment so I would appreciate if we could keep the comments relevant to the issue and not succumb to spamming it with emojis.