DEV Community

loading...

Discussion on: Angular State Management Without RxJS - An Experiment

Collapse
daviddalbusco profile image
David Dal Busco Author

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?

Thread Thread
daviddalbusco profile image
David Dal Busco Author

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.

Thread Thread
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.