Open
Description
Tutorial2.md contains an extra bracket in this code snippet. I commented it below. See "<--- Here".
object RootWorkflow : StatefulWorkflow<Unit, State, Nothing, Any>() {
// …
override fun render(
renderProps: Unit,
renderState: State,
context: RenderContext
): Any {
when (renderState) {
// When the state is Welcome, defer to the WelcomeWorkflow.
is Welcome -> {
// Render a child workflow of type WelcomeWorkflow. When renderChild is called, the
// infrastructure will create a child workflow with state if one is not already running.
val welcomeScreen = context.renderChild(WelcomeWorkflow) { output ->
// When WelcomeWorkflow emits LoggedIn, turn it into our login action.
login(output.username)
}
return welcomeScreen
}
// When the state is Todo, defer to the TodoListWorkflow.
is Todo -> {
val todoScreen
// = context.renderChild(TodoListWorkflow, Unit)) { // <--- Here
= context.renderChild(TodoListWorkflow, Unit) { // fixed
TODO() // we'll handle output of TodoListWorkflow later
}
return todoScreen
}
}
}
// …
}