Curious about the issue with the OnPush
change detection strategy not functioning properly in this demonstration.
My understanding is that OnPush
change detection should activate when a property reference changes. To ensure this, a new array must be set each time like so:
this.periodData$.subscribe((pd) => {
this.periodData = [...pd];
});
The template that displays periodData
appears as follows:
<div *ngFor="let p of periodData">{{p}}</div>
The value of periodData
is modified by the selection control in the demo.
While we can observe the changes through logging, the template does not reflect these updates. It works fine if change detection is left at default settings.
Any ideas on how to resolve this?