diff --git a/frontend/src/components/tree-editor/NodeFormDecision.tsx b/frontend/src/components/tree-editor/NodeFormDecision.tsx index 3d20ae98..b4d9c537 100644 --- a/frontend/src/components/tree-editor/NodeFormDecision.tsx +++ b/frontend/src/components/tree-editor/NodeFormDecision.tsx @@ -1,7 +1,7 @@ import { useRef, useEffect } from 'react' -import { Play } from 'lucide-react' +import { Play, Link2 } from 'lucide-react' import { DynamicArrayField } from './DynamicArrayField' -import { useTreeEditorStore } from '@/store/treeEditorStore' +import { useTreeEditorStore, collectAllNodesFlat } from '@/store/treeEditorStore' import type { TreeStructure, TreeOption } from '@/types' import { cn } from '@/lib/utils' import { InfoTip } from '@/components/common/InfoTip' @@ -195,12 +195,89 @@ export function NodeFormDecision({ node, onUpdate }: NodeFormDecisionProps) {
{optionLabelError.message}
)} + {/* Cross-reference link indicator */} + {option.next_node_id && (() => { + const treeStructure = useTreeEditorStore.getState().treeStructure + const childIds = new Set(node.children?.map(c => c.id) ?? []) + // Only show if it's a cross-reference (points outside children) + if (childIds.has(option.next_node_id)) return null + const allNodes = collectAllNodesFlat(treeStructure) + const target = allNodes.find(n => n.id === option.next_node_id) + if (!target) return null + return ( ++ Select an option, then pick a target node. This creates a loop-back or cross-reference. +
+