Skip to content

//workflow/com.squareup.workflow1/WorkflowInterceptor/RenderContextInterceptor/onRunningSideEffect

onRunningSideEffect

[jvm]
Content
open fun onRunningSideEffect(key: String, sideEffect: suspend () -> Unit, proceed: (key: String, sideEffect: suspend () -> Unit) -> Unit)
More info

Intercepts calls to BaseRenderContext.runningSideEffect, allowing the interceptor to wrap or replace the sideEffect and its key. This could be used to prevent a side effect from running, or to augment it with further effects.

The sideEffect function will perform the actual suspending side effect, and only return when the side effect is complete – this may be far in the future. This means the interceptor can be notified when the side effect ends by simply running code after sideEffect returns or throws.

The interceptor may run sideEffect in a different CoroutineContext, e.g to change its dispatcher or name, but should take care to use the original Job, or otherwise ensure that the structured concurrency contract is not broken.