I am curious about it too I have to say. Spontaneously I tend to think that changes are notified because the store is a proxy, but I can be fully wrong.
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...
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.
@vivainio@stenciljs You are right @vivainio with OnPush and more components, specially as you said with the click "outside", the changes are not detected
I would have to hook onChanges and triggers the detection "manually"
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.
@vivainio@stenciljs Not sure it would be the cleanest, it also skips the very first value, but if I do use the store and not the state in the template, then changes are detected 🤷
Haha this experiment is really fun 😋
17:41 PM - 15 Sep 2020
0
0
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you Simon 🙏.
I am curious about it too I have to say. Spontaneously I tend to think that changes are notified because the store is a proxy, but I can be fully wrong.
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...
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.