Ji Sungbin
06/26/2022, 11:14 AMRecompoer#runRecomposeAndApplyChanges
. This function tracks changes and requests invalidation in the while statement and remains suspended until new changes are made through waitWorkAvailable()
in the while statement.
awaitWorkAvailable()
works with suspendCancellableCoroutine
and assigns Continuation
to workContinuation
if there is no scheduled task. The workContinuation
is resumed in the invokeOnCompletion of a Job called effectJob
. Therefore, in order for workContinuation
to resume, effectJob
must be completed. Recomposer#close
, which completes it, is used only in the withRunningRecomposer
function, but withRunningRecomposer
is not used.
So where does workContinuation
resume? I had the same concern a month ago, but I still haven’t solved it.
(Job.cancel is also possible to call invokeOnComplete, but cancel is used only for lifecycle handling through Owner)