Skip to content

//workflow/com.squareup.workflow1/StatefulWorkflow/initialState

initialState

[jvm]
Content
abstract fun initialState(props: PropsT, snapshot: Snapshot?): StateT
More info

Called from RenderContext.renderChild when the state machine is first started, to get the initial state.

Parameters

jvm

snapshot

If the workflow is being created fresh, OR the workflow is being restored from a null or empty Snapshot, snapshot will be null. A snapshot is considered “empty” if Snapshot.bytes returns an empty ByteString, probably because snapshotState returned null. If the workflow is being restored from a Snapshot, snapshot will be the last value returned from snapshotState, and implementations that return something other than null should create their initial state by parsing their snapshot.