Skip to content

//workflow/com.squareup.workflow1/StatelessWorkflow

StatelessWorkflow

[jvm] abstract class StatelessWorkflowPropsT, out OutputT, out RenderingT> : Workflow<PropsT, OutputT, RenderingT>

Minimal implementation of Workflow that maintains no state of its own.

See also

jvm

com.squareup.workflow1.StatefulWorkflow

Parameters

jvm

PropsT

Typically a data class that is used to pass configuration information or bits of state that the workflow can always get from its parent and needn’t duplicate in its own state. May be Unit if the workflow does not need any props data.

OutputT

Typically a sealed class that represents “events” that this workflow can send to its parent. May be Nothing if the workflow doesn’t need to emit anything.

RenderingT

The value returned to this workflow’s parent during composition. Typically represents a “view” of this workflow’s props, current state, and children’s renderings. A workflow that represents a UI component may use a view model as its rendering type.

Constructors

StatelessWorkflow [jvm] fun StatelessWorkflow()Typically a data class that is used to pass configuration information or bits of state that the workflow can always get from its parent and needn’t duplicate in its own state.

Types

Name Summary
RenderContext [jvm]
Content
inner class RenderContext : BaseRenderContext<@UnsafeVariance()PropsT, Nothing, @UnsafeVariance()OutputT>


Functions

Name Summary
asStatefulWorkflow [jvm]
Content
override fun asStatefulWorkflow(): StatefulWorkflow<PropsT, *, OutputT, RenderingT>
More info
Satisfies the Workflow interface by wrapping this in a StatefulWorkflow with Unit state.


render [jvm]
Content
abstract fun render(renderProps: PropsT, context: StatelessWorkflow.RenderContext<PropsT, OutputT, RenderingT>): RenderingT
More info
Called at least once any time one of the following things happens:
  • This workflow’s renderProps change (via the parent passing a different one in).
  • A descendant (immediate or transitive child) workflow:
    • Changes its internal state.
    • Emits an output.
Never call this method directly.


Extensions

Name Summary
action [jvm]
Content
fun <PropsT, OutputT, RenderingT> StatelessWorkflow<PropsT, OutputT, RenderingT>.action(name: String = “”, update: WorkflowAction.Updater<PropsT, *, OutputT>.() -> Unit): WorkflowAction<PropsT, Nothing, OutputT>
fun <PropsT, OutputT, RenderingT> StatelessWorkflow<PropsT, OutputT, RenderingT>.action(name: () -> String, update: WorkflowAction.Updater<PropsT, *, OutputT>.() -> Unit): WorkflowAction<PropsT, Nothing, OutputT>
More info
Convenience to create a WorkflowAction with parameter types matching those of the receiving StatefulWorkflow.