initialState

abstract fun initialState(props: PropsT, snapshot: Snapshot?): StateT(source)

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

Parameters

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.


open fun initialState(props: PropsT, snapshot: Snapshot?, workflowScope: CoroutineScope): StateT(source)

See also

. This method should only be used with a SessionWorkflow. It's just a pass through here so that we can add this behavior for SessionWorkflow without disrupting all StatefulWorkflows.