Ji Sungbin05/21/2022, 8:01 PM
, and if this stack is not empty, it is popped from this stack and returned from
. Recomposition is performed through the returned
. Right? However, if there is no invalidation during the composition process, null is returned, and if invalidation is requested later, how does
detect this and recompose again? If look at the implementation of
, there is no code to track invalidations. Only request pop once.
EDIT: I found some clues. Suspend until invalidation is added through
val scope = if (invalidateStack.isNotEmpty()) invalidateStack.pop() else null // RecomposeScopeImpl?
. If there is a waiting task(
), it immediately resumes
and proceeds to recompose. Otherwise, it maintains the suspend state. The maintained suspend(
) is resumed when the operation is completed through the
, but as I traced the places where the
is used, there are only
. Where will this suspend resume? I think it’s time to record invalidation, but it wasn’t. They are recorded regardless of
Alexandre Elias [G]05/24/2022, 8:15 PM
, but it's only responsible for a portion of the invalidation logic. invalidate calls flow up to the
, which is the parent of the root CompositionContext.
might clarify things for you
Ji Sungbin05/25/2022, 12:16 AM