Package-level declarations

Types

Link copied to clipboard

A UiStateReadRecords.BinderEventListener that tracks per-binder shouldUpdate results and bind durations for observability.

Link copied to clipboard
data class ComponentState<S : StateContainer>(val value: S, val eventDispatchInfo: EventDispatchInfo? = null)

This object holds all the state the component created during render. It includes the mutable state, cached values, event dispatch info, etc.

Link copied to clipboard

Pre-computed index over a set of dirty scope keys for O(1) descendant lookups.

Link copied to clipboard
data class StateId(val treeId: Int, val hookGlobalKey: HookGlobalKey)
Link copied to clipboard
interface StateProvider

StateProvider is an abstraction used to supply the latest (and most accurate) value of a given State in a given scope, when read tracking is enabled.

Link copied to clipboard
class UiStateReadRecords(config: UiStateReadRecords.Config, binderEventListener: UiStateReadRecords.BinderEventListener? = null) : BinderObserver

A BinderObserver responsible for tracking and recording state reads in binders.

Functions

Link copied to clipboard
fun getDirtyScopes(updatedStates: Set<StateId>, stateReads: Map<StateId, ScatterSet<GlobalKey>>?, isComponentScope: Boolean = true): Set<GlobalKey>
Link copied to clipboard
fun getEffectDirtyScopes(updatedStates: Set<StateId>, stateReads: ScatterMap<StateId, out ScatterSet<Any>>?): ScatterSet<Any>

ScatterMap-backed variant of getDirtyScopes for effect scope tracking where uniqueIds may be Any (e.g. com.facebook.litho.HookGlobalKey) rather than String.

fun getEffectDirtyScopes(updatedStates: Set<StateId>, stateReads: Map<StateId, ScatterSet<Any>>?): ScatterSet<Any>

Variant of getDirtyScopes for effect scope tracking where uniqueIds may be Any (e.g. com.facebook.litho.HookGlobalKey) rather than String.

Link copied to clipboard
fun hasDirtyScopes(updatedStates: Set<StateId>, stateReads: Map<StateId, ScatterSet<GlobalKey>>?, isComponentScope: Boolean = true): Boolean

Allocation-free boolean counterpart of getDirtyScopes: whether any of updatedStates is dirty for stateReads (a spec state in component scope, or read by at least one scope). Early-exits on the first match; use when only the presence of dirty scopes matters, not the scope set.

inline fun hasDirtyScopes(updatedStates: Set<StateId>, stateReads: Map<StateId, ScatterSet<GlobalKey>>?, isComponentScope: Boolean = true, shouldSkip: (StateId) -> Boolean): Boolean

hasDirtyScopes over only the states shouldSkip rejects. Inline so the predicate is free.

Link copied to clipboard
inline fun StateProvider.withScope(source: TreeState, block: () -> Unit)