Robert Jaros
09/04/2025, 11:14 AMawaitOrScheduleNextFrameEnd
and awaitOrScheduleNextCompositionEnd()
mentioned in the description, but there are no such functions commited in code. I assume it was renamed to scheduleFrameEndCallback
but this is not suspending, so can't do what is described.Robert Jaros
09/04/2025, 11:24 AMSideEffect {}
. How is this new API different?Zach Klippenstein (he/him) [MOD]
09/04/2025, 1:46 PMscheduleFrameEndCallback
runs its callbacks after the apply phase as well, so after all non-suspending effects have run and the Applier
has updated the node tree.
In contrast with SideEffect
, that means it will run later (other effects may run after your effect). It will also force another frame to be scheduled if none is when the callback is registered, whereas SideEffect
will only run after a composition that was going to happen anyway.
Re: scheduleFrameEndCallback
, based on the docs it looks like it does have the same behavior as the functions you’re looking for but it just doesn’t use a suspend function probably to reduce overhead when not needed. As always, you can easily turn a callback into a suspend function with suspendCancellableCoroutine
.