addOnce won’t work if engine.frameId !== frame when it is called: the if won’t set the target visible and because we added the callback only once it won’t be reexecuted.
We would need a addOnceIf where we would provide the if condition along with the callback.