Skip to content

Commit

Permalink
Avoid hard-coding returnFalse and returnTrue handle fetching. (Flowis…
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyish authored and patrickalvesexperian committed Sep 3, 2024
1 parent a857119 commit 7f84162
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,15 @@ export const buildFlow = async ({
if (reactFlowNode.data.name === 'ifElseFunction' && typeof outputResult === 'object') {
let sourceHandle = ''
if (outputResult.type === true) {
sourceHandle = `${nodeId}-output-returnFalse-string|number|boolean|json|array`
// sourceHandle = `${nodeId}-output-returnFalse-string|number|boolean|json|array`
sourceHandle = (
reactFlowNode.data.outputAnchors.flatMap((n) => n.options).find((n) => n?.name === 'returnFalse') as any
)?.id
} else if (outputResult.type === false) {
sourceHandle = `${nodeId}-output-returnTrue-string|number|boolean|json|array`
// sourceHandle = `${nodeId}-output-returnTrue-string|number|boolean|json|array`
sourceHandle = (
reactFlowNode.data.outputAnchors.flatMap((n) => n.options).find((n) => n?.name === 'returnTrue') as any
)?.id
}

const ifElseEdge = reactFlowEdges.find((edg) => edg.source === nodeId && edg.sourceHandle === sourceHandle)
Expand Down

0 comments on commit 7f84162

Please sign in to comment.