Avoid hard-coding returnFalse and returnTrue handle fetching. (#3091)

This commit is contained in:
YISH
2024-08-28 19:06:10 +08:00
committed by GitHub
parent f3271589a8
commit 690d04309b
+8 -2
View File
@@ -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)