updateEffects

abstract fun EffectContext.updateEffects(effects: List<Effect>?): Runnable

Updates the set of effects within the associated ComponentTree.

When this method is invoked, the existing list is diffed with the incoming effects to determine the set of actions needed to advance to the new generation of effects. Note that identity is determined by Effect.uniqueId.

Effects to cleanup are determined by the following:

  • Any existing Effect that is no longer present will be cleaned up

  • Any Effect whose Effect.shouldUpdate returns true will be cleaned up

  • When state tracking is enabled, any Effect that reads an updated State will also be cleaned up

Effects to run are determined by the following:

  • All new effects will be run

  • Any Effect present in the new generation, but was previously detached will be run

Note that the returned Runnable must be called on the main thread.

Return

a Runnable that runs the incoming effects. Implementations should ensure that the effects are only ran once, even if the runnable is invoked multiple times.