three-mesh-ui
three-mesh-ui copied to clipboard
onAfterUpdate is not fired after initial component setup
Interesting. Looks like you are updating ThreeMeshUI outside of the main animation loop. Rather, you call it once via setTimeout.
Out of curiosity, I threw a basic counter in that fiddle and logged the number of calls to animate before onAfterUpdate
is called when ThreeMeshUI is updated in the animate
function. It isn't exactly consistent, but I don't see onAfterUpdate fire until after 5-7 calls to animate
. Feels like an asynchronous issue?
Actually, it's a little odd. Replacing the setTimeout
with a setInterval
still doesn't have the callback fire, regardless of how many times Update is called from it. Maybe a JS scope issue?
And I can't reproduce locally.
I just tested locally myself on my fork, also am unable to reproduce locally using similar code. Super odd.
Actually, it's a little odd. Replacing the setTimeout with a setInterval still doesn't have the callback fire, regardless of how many times Update is called from it. Maybe a JS scope issue?
This is expected, because when you don't set new properties to a component it has no reason to update, so it doesn't update, so it doesn't trigger onAfterUpdate
.
Here is the fiddle modified with a setInterval
, it does trigger onAfterUpdate
if I change the text content at each interval : https://jsfiddle.net/felixmariotto/2kny51ru/
However onAfterUpdate
is still not fired after the first update ( after the first call to setInterval
callback, when the panel reads "number of tries: 1" ).
I've no idea what is happening honestly... And it's late here ( in France ), so I will have to leave it like this for now... I keep the issue open, tell me if you run into the issue in another context.
All good, I've thankfully not run across this bug yet on my side. Just interesting to learn more about it. Thanks for your help again.