DEV Community

[Comment from a deleted post]
Collapse
 
ribizlim profile image
Mark Magyarodi

Ok, please do one more experiment for us: on page2 create a button to change the store, set the card component to onPush, and I bet there will be no update of the numbers in the card...

 
daviddalbusco profile image
David Dal Busco • Edited

Indeed did that experiment earlier this evening, if all components' change detection are set to OnPush and the components are away from the click event, then it wasn't automatically re-rendered.

For such case I would have to hook on onChances and triggers or mark the change detection.

Afterwards I improved this test by using the store directly in the template instead of the state. The first value pushed in the store did not trigger the re-rendering but any following update to the store were actually detected as changes.