DEV Community

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

I'm not sure that you don't get the same result if you just use simple plain objects. re-rendering works for sure. the only feature missing is the onChange event.

but including stencil's reactivity into angular makes not much sense (correct me if I'm wrong)

Collapse
 
daviddalbusco profile image
David Dal Busco

if you "just" add a simple plain objects in a provider/service for example, it re-renders only if you takes care of triggering the change detection "manually", what I was looking to avoid.

but of course I understand your point.

I could have use another store, like Zustand or else. I picked the stencil one because it is lightweight and bare simple.

Collapse
 
ribizlim profile image
Mark Magyarodi

"if you takes care of triggering" - how come does stencil take care?

 
daviddalbusco profile image
David Dal Busco

well, first thing I should probably mention is even though it is called "stencil store" there is no "stencil / web components" inside.

as I said in another comment, if I would have to bet, I would say that my spontaneous understanding is that the store is using a proxy and that's why the change detection is noticing the modifications. But, I can't be totally uncorrect. If anyone want to give a better explanation, would like to hear it too.

 
ribizlim profile image
Mark Magyarodi

I did check the source of stencil store before my first comment, and I found only stencil specific updates reacting on store changes. But being a proxy wouldn't trigger angular CD either. I'm still sure about my original statement, stencil store work only because the same reason a plain js object would.