onAction

open suspend fun PipelineContext<S, I, A>.onAction(action: A): A?

A callback that is invoked each time an MVIAction has been sent. This is invoked after the action has been sent, but before the ActionConsumer handles it. This function will always be invoked, even after the action is later dropped because of ActionShareBehavior, and it will be invoked before the ActionReceiver.send returns, if it has been suspended.

  • Return null to veto the processing and prevent other plugins from using the action.

  • Return another action to replace action with another one and continue with the chain.

  • Return action to continue processing, leaving the it unmodified.

  • Execute other operations using PipelineContext