Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ fun <PropsT, OutputT, RenderingT> renderWorkflowIn(
// It might look weird to start by consuming the output before getting the rendering below,
// but remember the first render pass already occurred above, before this coroutine was even
// launched.
runner.nextOutput()
?.let { onOutput(it.value) }
val output = runner.nextOutput()

// After receiving an output, the next render pass must be done before emitting that output,
// so that the workflow states appear consistent to observers of the outputs and renderings.
renderingsAndSnapshots.value = runner.nextRendering()
output?.let { onOutput(it.value) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ class RenderWorkflowInTest {
assertEquals(
listOf(
"rendering({no output})",
"output(output)",
"rendering(output)"
"rendering(output)",
"output(output)"
),
events
)
Expand Down