CANCEL_PREVIOUS

Cancels the previous execution. By applying this ExecutionPolicy the previous execution of the same DSL block will be canceled.

Example:

inState<SomeState> {
on<Action1>(executionPolicy = CANCEL_PREVIOUS_EXECUTION) { action, stateSnapshot ->
delay(1000)
OverrideState(...)
}
}

Dispatching Action1 two times right after each other means that with this policy the first dispatching of Action1 will be canceled as soon as the second dispatching of Action1 is happening. That is what CANCEL_PREVIOUS means.

(uses flatMapLatest under the hood)

Properties

Link copied to clipboard
Link copied to clipboard