You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a component with two @Input, one of them is a setter method (it propably does not matter but having a method helps to see the problem).
Let's call "value1" the Input using a setter method and "value2" the Input applied directly on a property.
Everytime "value2" changes, the setter method of "value1" is called, although the value didn't changed. If you remove the optional chaining there is no problem.
After a long debugging session in the change detector I tracked down the problem to this line https://github.com/angular/angular/blob/master/packages/core/src/render3/pipe.ts#L221
where "bindingToInvalidateIdx" is for some reason the index of "value1" and not "value2". Because of this when the change detector runs for "value1" the old value is "NO_CHANGE" and not the actual value, hence refreshing the input.
🐞 bug report
Affected Package
@angular/*** 9.1.9
Is this a regression?
Probably
Description
Prerequisite :
Create a component with two
@Input
, one of them is a setter method (it propably does not matter but having a method helps to see the problem).Let's call "value1" the Input using a setter method and "value2" the Input applied directly on a property.
Use it :
Use this component in a view with this configuration
What happens :
Everytime "value2" changes, the setter method of "value1" is called, although the value didn't changed.
If you remove the optional chaining there is no problem.
After a long debugging session in the change detector I tracked down the problem to this line
https://github.com/angular/angular/blob/master/packages/core/src/render3/pipe.ts#L221
where "bindingToInvalidateIdx" is for some reason the index of "value1" and not "value2". Because of this when the change detector runs for "value1" the old value is "NO_CHANGE" and not the actual value, hence refreshing the input.
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-xkcbs1
In the setter of "value1" I increment a counter, this counter is increment when "value2" changes.
🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: