Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(workflows): render each step once in the list view (#113757)

Meikel Ratzf92e349b19d1
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeBranch.tsx b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeBranch.tsx
index f80a34ec332b..28b7a1950376 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeBranch.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeBranch.tsx
@@ -35,13 +35,13 @@ export function HogFlowTreeBranch({
branchCollapsed: boolean
onToggleCollapsed: () => void
onFocusBranch?: (path: HogFlowEdge[]) => void
- onSelectContinuation: (actionId: string, path: HogFlowEdge[]) => void
+ onSelectContinuation: (actionId: string) => void
path: HogFlowEdge[]
children: ReactNode
}): JSX.Element {
const { setSelectedNodeId } = useActions(hogFlowEditorLogic)
const { selectedBranch, setSelectedBranch } = useHogFlowBranchSelection()
- const joinAction = node.joinAction
+ const continuation = branch.sequence.continueTo ?? node.joinAction
const branchIndex = branch.edge.type === 'branch' ? (branch.edge.index ?? index) : null
const pathColor = getHogFlowBranchColor(branchIndex)
const isBranchSelected = selectedBranch?.actionId === node.action.id && selectedBranch.index === branchIndex
@@ -71,10 +71,10 @@ export function HogFlowTreeBranch({
: `${branchIndex + 1}`
const selectContinuation = (): void => {
- if (joinAction) {
+ if (continuation) {
setSelectedBranch(null)
- setSelectedNodeId(joinAction.id)
- onSelectContinuation(joinAction.id, path)
+ setSelectedNodeId(continuation.id)
+ onSelectContinuation(continuation.id)
}
}
@@ -179,7 +179,7 @@ export function HogFlowTreeBranch({
</div>
<div className={cn('min-w-0 ps-3 ms-2 mt-2', branchCollapsed && 'hidden')}>
{children}
- {joinAction && (
+ {continuation && (
<div className="relative py-1">
<LemonButton
type="tertiary"
@@ -189,7 +189,7 @@ export function HogFlowTreeBranch({
onClick={selectContinuation}
data-attr="workflow-tree-select-continuation"
>
- <span className="break-words whitespace-normal">{`Continue to: ${joinAction.name}`}</span>
+ <span className="break-words whitespace-normal">{`Continue to: ${continuation.name}`}</span>
</LemonButton>
</div>
)}
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeEditor.tsx b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeEditor.tsx
index 1b7b25dc2a73..2cb4d2c48f4d 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeEditor.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeEditor.tsx
@@ -41,6 +41,7 @@ export function HogFlowTreeEditor(): JSX.Element {
const tree = useMemo(() => buildWorkflowTree(workflow), [workflow])
const focusedPath = useMemo(() => findWorkflowTreePath(tree, focusedEdges), [tree, focusedEdges])
const focused = focusedPath.at(-1)
+ const focusedContinuation = focused ? (focused.branch.sequence.continueTo ?? focused.node.joinAction) : null
const activeDropzones = !!nodeToBeAdded
const updateViewState = (key: string, state: WorkflowTreeNodeViewState): void => {
@@ -103,10 +104,10 @@ export function HogFlowTreeEditor(): JSX.Element {
}
}
- const selectContinuation = (actionId: string, path: HogFlowEdge[]): void => {
+ const selectContinuation = (actionId: string): void => {
setSelectedBranch(null)
setSelectedNodeId(actionId)
- const destinationPath = getWorkflowTreeContinuationPath(tree, path, actionId)
+ const destinationPath = getWorkflowTreeContinuationPath(tree, actionId)
revealPath(destinationPath)
// A path inside the focused view can join at a step that the focused view also shows, so leave
// focus only for a join that the user cannot already see.
@@ -295,15 +296,15 @@ export function HogFlowTreeEditor(): JSX.Element {
insertionLabel={`Add step to ${focused.branch.label}`}
/>
)}
- {focused?.node.joinAction && (
+ {focusedContinuation && (
<LemonButton
type="secondary"
size="small"
className="self-start max-w-full mt-3"
- onClick={() => selectContinuation(focused.node.joinAction!.id, focusedEdges.slice(0, -1))}
+ onClick={() => selectContinuation(focusedContinuation.id)}
data-attr="workflow-tree-focus-continuation"
>
- <span className="break-words whitespace-normal">{`Continue to: ${focused.node.joinAction.name}`}</span>
+ <span className="break-words whitespace-normal">{`Continue to: ${focusedContinuation.name}`}</span>
</LemonButton>
)}
</div>
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeNode.tsx b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeNode.tsx
index 338108f5a082..5f44269b528c 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeNode.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/tree/HogFlowTreeNode.tsx
@@ -41,7 +41,7 @@ export function HogFlowTreeNode({
onDragStart: (event: DragEvent<HTMLDivElement>, actionId: string, dragPreviewElement: HTMLDivElement | null) => void
showIncomingConnector?: boolean
onFocusBranch?: (path: HogFlowEdge[]) => void
- onSelectContinuation: (actionId: string, path: HogFlowEdge[]) => void
+ onSelectContinuation: (actionId: string) => void
path: HogFlowEdge[]
viewStates: Record<string, WorkflowTreeNodeViewState>
onViewStateChange: (key: string, state: WorkflowTreeNodeViewState) => void
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.test.ts b/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.test.ts
index 370c77945076..67134edfba6c 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.test.ts
@@ -12,7 +12,6 @@ import {
getWorkflowTreeBranchSummary,
getWorkflowTreeContinuationPath,
getWorkflowTreeOccurrenceKey,
- getWorkflowTreeStepId,
getWorkflowTreeStepIds,
} from './workflowTreePresentation'
@@ -181,6 +180,36 @@ describe('buildWorkflowTree', () => {
).toEqual([])
})
+ it('joins a nested path that links to a step another route shows', () => {
+ const tree = buildWorkflowTree(
+ workflow(
+ [
+ action('trigger', 'trigger'),
+ action('outer', 'conditional_branch'),
+ action('inner', 'conditional_branch'),
+ action('shared'),
+ action('other'),
+ action('join'),
+ action('exit', 'exit'),
+ ],
+ [
+ edge('trigger', 'outer'),
+ edge('outer', 'shared', 'branch', 0),
+ edge('outer', 'inner'),
+ edge('inner', 'shared', 'branch', 0),
+ edge('inner', 'other'),
+ edge('shared', 'join'),
+ edge('other', 'join'),
+ edge('join', 'exit'),
+ ]
+ )
+ )
+
+ const inner = tree.nodes[1].branches[1].sequence.nodes[0]
+ expect(inner.branches[0].sequence.continueTo?.id).toBe('shared')
+ expect(inner.joinEdges).toEqual([edge('shared', 'join'), edge('other', 'join')])
+ })
+
it('collects branching steps nested inside a path so collapsing covers them', () => {
const tree = buildWorkflowTree(
workflow(
@@ -266,11 +295,11 @@ describe('buildWorkflowTree', () => {
'followup',
])
const innerPath = [edge('outer', 'trial', 'branch', 0), edge('inner', 'guided', 'branch', 0)]
- expect(getWorkflowTreeContinuationPath(tree, innerPath, 'followup')).toEqual(innerPath.slice(0, 1))
- expect(getWorkflowTreeContinuationPath(tree, innerPath, 'shared')).toEqual([])
+ expect(getWorkflowTreeContinuationPath(tree, 'followup')).toEqual(innerPath.slice(0, 1))
+ expect(getWorkflowTreeContinuationPath(tree, 'shared')).toEqual([])
})
- it('keeps the selected occurrence when paths share a branching action', () => {
+ it('shows a step that several paths share once and links to it from the other paths', () => {
const tree = buildWorkflowTree(
workflow(
[
@@ -294,14 +323,59 @@ describe('buildWorkflowTree', () => {
)
)
const firstPath = [edge('outer', 'wait', 'branch', 0), edge('wait', 'matched', 'branch', 0)]
- const secondPath = [edge('outer', 'wait', 'branch', 1), edge('wait', 'matched', 'branch', 0)]
+ const [, secondRoute] = tree.nodes[1].branches
+
+ expect(findWorkflowTreePath(tree, firstPath).map(({ branch }) => branch.edge)).toEqual(firstPath)
+ expect(getWorkflowTreeContinuationPath(tree, 'matched')).toEqual(firstPath)
+ expect(secondRoute.sequence.nodes).toEqual([])
+ expect(secondRoute.sequence.continueTo?.id).toBe('wait')
+ expect(secondRoute.sequence.trailingEdge).toEqual(edge('outer', 'wait', 'branch', 1))
+ expect(getWorkflowTreeBranchSummary(tree.nodes[1], secondRoute)).toBe('0 steps · Continue to: wait')
+ expect(
+ findWorkflowTreePath(tree, [edge('outer', 'wait', 'branch', 1), edge('wait', 'matched', 'branch', 0)])
+ ).toEqual([])
+ })
+
+ it('shows each step once when nested branches merge only some of their paths', () => {
+ const levels = 12
+ const actions = [action('trigger', 'trigger'), action('exit', 'exit')]
+ const edges = [edge('trigger', 'split-0')]
+ for (let level = 0; level < levels; level++) {
+ const next = level + 1 < levels ? `split-${level + 1}` : 'exit'
+ actions.push(
+ action(`split-${level}`, 'conditional_branch'),
+ action(`a-${level}`),
+ action(`b-${level}`),
+ action(`merge-${level}`)
+ )
+ edges.push(
+ edge(`split-${level}`, `a-${level}`, 'branch', 0),
+ edge(`split-${level}`, `b-${level}`, 'branch', 1),
+ edge(`split-${level}`, 'exit'),
+ edge(`a-${level}`, `merge-${level}`),
+ edge(`b-${level}`, `merge-${level}`),
+ edge(`merge-${level}`, next)
+ )
+ }
+ const tree = buildWorkflowTree(workflow(actions, edges))
- for (const path of [firstPath, secondPath]) {
- expect(findWorkflowTreePath(tree, path).map(({ branch }) => branch.edge)).toEqual(path)
- expect(getWorkflowTreeContinuationPath(tree, path, 'matched')).toEqual(path)
+ const placements: string[] = []
+ const collect = (sequence: typeof tree): void => {
+ for (const node of sequence.nodes) {
+ placements.push(node.action.id)
+ node.branches.forEach((branch) => collect(branch.sequence))
+ }
}
- expect(getWorkflowTreeStepId('matched', firstPath)).not.toBe(getWorkflowTreeStepId('matched', secondPath))
- expect(findWorkflowTreePath(tree, [edge('wait', 'matched', 'branch', 0)])).toEqual([])
+ collect(tree)
+
+ expect(placements).toHaveLength(actions.length)
+ expect(new Set(placements).size).toBe(actions.length)
+ const lastSplit = findWorkflowTreePath(
+ tree,
+ Array.from({ length: levels }, (_, level) => edge(`split-${level}`, `a-${level}`, 'branch', 0))
+ ).at(-1)
+ expect(lastSplit?.node.branches[1].sequence.continueTo?.id).toBe(`merge-${levels - 1}`)
+ expect(isWorkflowTreeComplete(workflow(actions, edges))).toBe(true)
})
it.each([
@@ -401,4 +475,32 @@ describe('buildWorkflowTree', () => {
edge('shared', 'condition'),
])
})
+
+ it('refuses to move a branching action whose path links to a step that another route enters', () => {
+ const workflowWithSharedStep = workflow(
+ [
+ action('trigger', 'trigger'),
+ action('outer', 'conditional_branch'),
+ action('inner', 'conditional_branch'),
+ action('shared'),
+ action('other'),
+ action('join'),
+ action('after'),
+ action('exit', 'exit'),
+ ],
+ [
+ edge('trigger', 'outer'),
+ edge('outer', 'shared', 'branch', 0),
+ edge('outer', 'inner'),
+ edge('inner', 'shared', 'branch', 0),
+ edge('inner', 'other'),
+ edge('shared', 'join'),
+ edge('other', 'join'),
+ edge('join', 'after'),
+ edge('after', 'exit'),
+ ]
+ )
+
+ expect(computeMoveTreeBranchEdges(workflowWithSharedStep, 'inner', edge('join', 'after'), false)).toBeNull()
+ })
})
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.ts b/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.ts
index 286a8eddee14..1c160355e2d1 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.ts
+++ b/products/workflows/frontend/Workflows/hogflows/tree/workflowTree.ts
@@ -5,6 +5,7 @@ export const BRANCHING_ACTION_TYPES = ['conditional_branch', 'random_cohort_bran
export interface WorkflowTreeSequence {
nodes: WorkflowTreeNode[]
trailingEdge: HogFlowEdge | null
+ continueTo: HogFlowAction | null
}
export interface WorkflowTreeNode {
@@ -112,6 +113,33 @@ function setsEqual(left: Set<string>, right: Set<string>): boolean {
return left.size === right.size && [...left].every((value) => right.has(value))
}
+function postOrder(actionIds: string[], outgoingEdgesByActionId: Map<string, HogFlowEdge[]>): string[] {
+ const order: string[] = []
+ const visited = new Set<string>()
+
+ for (const rootId of actionIds) {
+ if (visited.has(rootId)) {
+ continue
+ }
+ visited.add(rootId)
+ const stack: { actionId: string; nextEdge: number }[] = [{ actionId: rootId, nextEdge: 0 }]
+
+ while (stack.length) {
+ const frame = stack[stack.length - 1]
+ const edge = (outgoingEdgesByActionId.get(frame.actionId) ?? [])[frame.nextEdge++]
+ if (!edge) {
+ order.push(frame.actionId)
+ stack.pop()
+ } else if (!visited.has(edge.to)) {
+ visited.add(edge.to)
+ stack.push({ actionId: edge.to, nextEdge: 0 })
+ }
+ }
+ }
+
+ return order
+}
+
function buildPostDominators(
actionIds: string[],
outgoingEdgesByActionId: Map<string, HogFlowEdge[]>
@@ -124,10 +152,14 @@ function buildPostDominators(
])
)
+ // Visiting successors first lets each pass see final successor sets, so the loop ends after one or two
+ // passes. In array order, a long chain needs one pass per step, and each pass costs O(n²).
+ const visitOrder = postOrder(actionIds, outgoingEdgesByActionId)
+
for (let pass = 0; pass < actionIds.length * actionIds.length; pass++) {
let changed = false
- for (const actionId of actionIds) {
+ for (const actionId of visitOrder) {
const successors = (outgoingEdgesByActionId.get(actionId) ?? [])
.map((edge) => postDominators.get(edge.to))
.filter((set): set is Set<string> => !!set)
@@ -198,21 +230,31 @@ function findBranchJoinActionId(
)
}
+// Walk the edges and not the tree, because a path can end with a link to a step that renders under another
+// path but still reaches the join.
function collectBranchJoinEdges(
- sequence: WorkflowTreeSequence,
+ branchingActionId: string,
joinActionId: string,
- joinEdges: Map<string, HogFlowEdge>
-): void {
- if (sequence.trailingEdge?.to === joinActionId) {
- const edge = sequence.trailingEdge
- joinEdges.set(`${edge.from}:${edge.to}:${edge.type}:${edge.index ?? ''}`, edge)
- }
-
- for (const node of sequence.nodes) {
- for (const branch of node.branches) {
- collectBranchJoinEdges(branch.sequence, joinActionId, joinEdges)
+ outgoingEdgesByActionId: Map<string, HogFlowEdge[]>
+): HogFlowEdge[] {
+ const joinEdges: HogFlowEdge[] = []
+ const visited = new Set([branchingActionId])
+ const stack: { actionId: string; nextEdge: number }[] = [{ actionId: branchingActionId, nextEdge: 0 }]
+
+ while (stack.length) {
+ const frame = stack[stack.length - 1]
+ const edge = (outgoingEdgesByActionId.get(frame.actionId) ?? [])[frame.nextEdge++]
+ if (!edge) {
+ stack.pop()
+ } else if (edge.to === joinActionId) {
+ joinEdges.push(edge)
+ } else if (!visited.has(edge.to)) {
+ visited.add(edge.to)
+ stack.push({ actionId: edge.to, nextEdge: 0 })
}
}
+
+ return joinEdges
}
export function buildWorkflowTree(workflow: Pick<HogFlow, 'actions' | 'edges'>): WorkflowTreeSequence {
@@ -238,23 +280,27 @@ export function buildWorkflowTree(workflow: Pick<HogFlow, 'actions' | 'edges'>):
const postDominatorsByActionId = buildPostDominators([...actionsById.keys()], outgoingEdgesByActionId)
+ // Each action renders once. A path that reaches an action that is already placed ends with a link to
+ // it. Copying the shared steps under every path instead grows with the number of routes through the
+ // graph, which is exponential when branches nest and only some of their paths merge.
+ const placedActionIds = new Set<string>()
+
const buildSequence = (
startActionId: string | undefined,
stopActionId: string | null,
- incomingEdge: HogFlowEdge | null,
- ancestors: Set<string>
+ incomingEdge: HogFlowEdge | null
): WorkflowTreeSequence => {
const nodes: WorkflowTreeNode[] = []
let actionId = startActionId
let edgeIntoAction = incomingEdge
- while (actionId && actionId !== stopActionId && !ancestors.has(actionId)) {
+ while (actionId && actionId !== stopActionId && !placedActionIds.has(actionId)) {
const action = actionsById.get(actionId)
if (!action) {
break
}
- ancestors.add(actionId)
+ placedActionIds.add(actionId)
const outgoingEdges = outgoingEdgesByActionId.get(actionId) ?? []
const node: WorkflowTreeNode = {
action,
@@ -284,30 +330,31 @@ export function buildWorkflowTree(workflow: Pick<HogFlow, 'actions' | 'edges'>):
node.branches = outgoingEdges.map((edge) => ({
edge,
label: getWorkflowBranchLabel(action, edge),
- sequence: buildSequence(edge.to, joinActionId, edge, new Set(ancestors)),
+ sequence: buildSequence(edge.to, joinActionId, edge),
}))
if (joinActionId) {
- const joinEdges = new Map<string, HogFlowEdge>()
- for (const branch of node.branches) {
- collectBranchJoinEdges(branch.sequence, joinActionId, joinEdges)
- }
- node.joinEdges = [...joinEdges.values()]
+ node.joinEdges = collectBranchJoinEdges(actionId, joinActionId, outgoingEdgesByActionId)
}
nodes.push(node)
if (!joinActionId) {
- return { nodes, trailingEdge: null }
+ return { nodes, trailingEdge: null, continueTo: null }
}
actionId = joinActionId
edgeIntoAction = null
}
- return { nodes, trailingEdge: actionId === stopActionId ? edgeIntoAction : null }
+ const continueTo = actionId && actionId !== stopActionId ? (actionsById.get(actionId) ?? null) : null
+ return {
+ nodes,
+ trailingEdge: actionId === stopActionId || continueTo ? edgeIntoAction : null,
+ continueTo: edgeIntoAction ? continueTo : null,
+ }
}
const trigger = workflow.actions.find((action) => action.type === 'trigger') ?? workflow.actions[0]
- return buildSequence(trigger?.id, null, null, new Set())
+ return buildSequence(trigger?.id, null, null)
}
export function isWorkflowTreeComplete(workflow: Pick<HogFlow, 'actions' | 'edges'>): boolean {
@@ -342,6 +389,22 @@ function collectWorkflowTreeActionIds(sequence: WorkflowTreeSequence, actionIds:
}
}
+function collectActionIdsBefore(startActionId: string, stopActionId: string, edges: HogFlowEdge[]): Set<string> {
+ const actionIds = new Set([startActionId])
+ const queue = [startActionId]
+
+ for (let index = 0; index < queue.length; index++) {
+ for (const edge of edges) {
+ if (edge.from === queue[index] && edge.to !== stopActionId && !actionIds.has(edge.to)) {
+ actionIds.add(edge.to)
+ queue.push(edge.to)
+ }
+ }
+ }
+
+ return actionIds
+}
+
export function computeMoveTreeBranchEdges(
workflow: Pick<HogFlow, 'actions' | 'edges'>,
movingActionId: string,
@@ -356,9 +419,17 @@ export function computeMoveTreeBranchEdges(
return null
}
- const movedActionIds = new Set([movingActionId])
- for (const branch of branchNode.branches) {
- collectWorkflowTreeActionIds(branch.sequence, movedActionIds)
+ // Collect the block from the edges and not from the tree, because a path can end with a link to a step
+ // that renders under another path but still runs before the join.
+ const movedActionIds = collectActionIdsBefore(movingActionId, joinActionId, workflow.edges)
+
+ // A route from outside the block that enters one of its steps would follow that step to the new place and
+ // skip the join, so refuse the move.
+ const enteredFromOutside = workflow.edges.some(
+ (edge) => edge.to !== movingActionId && movedActionIds.has(edge.to) && !movedActionIds.has(edge.from)
+ )
+ if (enteredFromOutside) {
+ return null
}
if (movedActionIds.has(targetEdge.from) || movedActionIds.has(targetEdge.to)) {
diff --git a/products/workflows/frontend/Workflows/hogflows/tree/workflowTreePresentation.ts b/products/workflows/frontend/Workflows/hogflows/tree/workflowTreePresentation.ts
index c4daff2fc24b..5b242e536b62 100644
--- a/products/workflows/frontend/Workflows/hogflows/tree/workflowTreePresentation.ts
+++ b/products/workflows/frontend/Workflows/hogflows/tree/workflowTreePresentation.ts
@@ -42,19 +42,22 @@ export function findWorkflowTreePath(sequence: WorkflowTreeSequence, edges: HogF
return []
}
-export function getWorkflowTreeContinuationPath(
- tree: WorkflowTreeSequence,
- path: HogFlowEdge[],
- actionId: string
-): HogFlowEdge[] {
- for (let depth = path.length; depth > 0; depth--) {
- const ancestorPath = path.slice(0, depth)
- const sequence = findWorkflowTreePath(tree, ancestorPath).at(-1)?.branch.sequence
- if (sequence?.nodes.some((node) => node.action.id === actionId)) {
- return ancestorPath
+export function getWorkflowTreeContinuationPath(tree: WorkflowTreeSequence, actionId: string): HogFlowEdge[] {
+ const search = (sequence: WorkflowTreeSequence, path: HogFlowEdge[]): HogFlowEdge[] | null => {
+ for (const node of sequence.nodes) {
+ if (node.action.id === actionId) {
+ return path
+ }
+ for (const branch of node.branches) {
+ const found = search(branch.sequence, [...path, branch.edge])
+ if (found) {
+ return found
+ }
+ }
}
+ return null
}
- return []
+ return search(tree, []) ?? []
}
function collectStepIds(sequence: WorkflowTreeSequence, stepIds: Set<string>): void {
@@ -73,6 +76,9 @@ export function getWorkflowTreeStepIds(sequence: WorkflowTreeSequence): Set<stri
}
function getPathDestination(sequence: WorkflowTreeSequence): string {
+ if (sequence.continueTo) {
+ return `Continue to: ${sequence.continueTo.name}`
+ }
const lastNode = sequence.nodes.at(-1)
if (lastNode?.action.type === 'exit') {
return 'End workflow'
@@ -86,7 +92,8 @@ function getPathDestination(sequence: WorkflowTreeSequence): string {
export function getWorkflowTreeBranchSummary(node: WorkflowTreeNode, branch: WorkflowTreeBranch): string {
const count = getWorkflowTreeStepIds(branch.sequence).size
- const destination = node.joinAction ? `Continue to: ${node.joinAction.name}` : getPathDestination(branch.sequence)
+ const continuation = branch.sequence.continueTo ?? node.joinAction
+ const destination = continuation ? `Continue to: ${continuation.name}` : getPathDestination(branch.sequence)
return `${count} ${count === 1 ? 'step' : 'steps'} · ${destination}`
}