#Component Effect timing is different with property binding and literal value syntax ?
22 messages · Page 1 of 1 (latest)
This one gave me a head scratch for a good 15min 😄
This is due to you mutating the array and Angular not applying the interpolation because the array reference didn't change
The effect just run fine
Also there is a little timing difference between a binding and a static attribute.
The static attribute is accessible earlier, as you can see when the effect parent effect runs
Right, thats a bad example - I wanted to showcase the fact, that when there is a property binding, the component you get from view child query has still its initial value for the input, while when there is an attribute, its set.
I will change the example
The example should be clearer now
I think this falls under https://github.com/angular/angular/issues/59067
in your transform your input into a required input you fall into the same situation, the binding just throws.
So its expected behavior and requires userland handling?
like this comment says: https://github.com/angular/angular/issues/59067#issuecomment-2880931140
Yes, it's based on your issue
It clearly shows that it's a querying issue, not an effect one
From my point of view I think the timing of the effect is unlucky - it should be executed first, when the inputs have been set, so that initial values must not be handled by the effect or in other words the side effect is not triggered with a useless value since right after the first execution the real value gets set and triggers the effect again.
viewChild() is just a signal, it does not know that it should not notify the effect i guess
maybe component effects can filter out triggers until all children have run on init
effect just follows the reactivity. The query shouldn't be populated (and thus not trigger the effect) until the components/directives have their inputs set