StateUpdater

interface StateUpdater

StateUpdater lets a Component rendered with a scoped ComponentContext interact with Litho's state. An implementation of StateUpdater is responsible for collecting state update operations and schedule a new Resolve/Layout step to occur. The default implementation of StateUpdater is ComponentTree, but it might be useful to implement this interface when integrating Litho in different rendering frameworks where it's not desirable for Litho to control the resolve/layout/commit process.

Inheritors

Properties

Link copied to clipboard
abstract var isFirstMount: Boolean

Functions

Link copied to clipboard
abstract fun applyLazyStateUpdatesForContainer(globalKey: String, container: StateContainer, isLayoutState: Boolean): StateContainer
Link copied to clipboard
abstract fun <T> canSkipStateUpdate(newValueFunction: (T) -> T, globalKey: String, hookStateIndex: Int, isLayoutState: Boolean): Boolean
abstract fun <T> canSkipStateUpdate(globalKey: String, hookStateIndex: Int, newValue: T?, isLayoutState: Boolean): Boolean
Link copied to clipboard
abstract fun getCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, isLayoutState: Boolean): Any?

Returns a Cached value that is accessible across all re-render operations.

Link copied to clipboard
abstract fun getEventTrigger(key: String): EventTrigger<*>?
abstract fun getEventTrigger(handle: Handle, id: Int): EventTrigger<*>?
Link copied to clipboard
abstract fun putCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, cachedValue: Any?, isLayoutState: Boolean)

Stores a Cached value that will be accessible across all re-render operations.

Link copied to clipboard
abstract fun removePendingStateUpdate(key: String, isLayoutState: Boolean)

Removes a state update that was previously enqueued if the state update has not been processed yet.

Link copied to clipboard
abstract fun updateHookStateAsync(globalKey: String, updateBlock: HookUpdater, attribution: String?, isLayoutState: Boolean)

Same as updateStateAsync but for Hook State.

Link copied to clipboard
abstract fun updateHookStateSync(globalKey: String, updateBlock: HookUpdater, attribution: String?, isLayoutState: Boolean)

Same as updateStateSync but for Hook State.

Link copied to clipboard
abstract fun updateStateAsync(globalKey: String, stateUpdate: StateContainer.StateUpdate, attribution: String?, isLayoutState: Boolean)

Enqueues a state update that will schedule a new render on a Thread controlled by the Litho infrastructure.

Link copied to clipboard
abstract fun updateStateLazy(globalKey: String, stateUpdate: StateContainer.StateUpdate, isLayoutState: Boolean)

Enqueues a state update that will not schedule a new render. The new state will immediately be visible in Event Handlers and it will be visible in the next render phase.

Link copied to clipboard
abstract fun updateStateSync(globalKey: String, stateUpdate: StateContainer.StateUpdate, attribution: String?, isLayoutState: Boolean)

Enqueues a state update that will schedule a new render on the calling thread at the end of its current run-loop. It is expected that the calling thread has an active Looper.