Skip to content

Commit

Permalink
Issue 351: Update input to root workflow in WorkflowHost
Browse files Browse the repository at this point in the history
Resolves #351
  • Loading branch information
Dave Apgar committed Jul 18, 2019
1 parent a601bc4 commit 1e7a0a2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions swift/Workflow/Sources/WorkflowHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ public final class WorkflowHost<WorkflowType: Workflow> {

}

/// Update the input for the workflow. Will cause a render pass.
public func update(workflow: WorkflowType) {
rootNode.update(workflow: workflow)

// Treat the update as an "output" from the workflow to force a render pass and update the debug info.
let output = WorkflowNode<WorkflowType>.Output(
outputEvent: nil,
// TODO FIXME HAX HAX HAX: Better debug info generation, specifically the "type".
debugInfo: WorkflowUpdateDebugInfo(
workflowType: "\(WorkflowType.self)",
kind: .didUpdate(source: .external)))
handle(output: output)
}

private func handle(output: WorkflowNode<WorkflowType>.Output) {
mutableRendering.value = rootNode.render()

Expand Down

0 comments on commit 1e7a0a2

Please sign in to comment.