applyExternalStates
Deprecated
Dispatch StoreAction.Hydrate instead, so external state is ordered against every other dispatch rather than written alongside the pipeline.
Replace with
dispatchAndAwait(StoreAction.Hydrate(states, "External"))Content copied to clipboard
Replaces the state of the named modules without running their reducers.
Delegates to StoreAction.Hydrate, which the store applies from its dispatch loop, so the update is ordered against every other dispatch rather than written alongside them.
Each module's state is written to its own kotlinx.coroutines.flow.MutableStateFlow, so a single module's update is atomic, but the map is not applied as one transaction: a collector of one module can observe its new value before another module in the same call has been written.
Example usage:
storeAccessor.dispatchAndAwait(
StoreAction.Hydrate(
states = mapOf("com.example.CounterState" to CounterState(value = 42)),
origin = "DevTools"
)
)Content copied to clipboard
Parameters
states
Map of state class qualified names to new state instances