diff --git a/GUI/src/hooks/flow/useOnNodeDelete.ts b/GUI/src/hooks/flow/useOnNodeDelete.ts index 5c1bf6565..79b21c053 100644 --- a/GUI/src/hooks/flow/useOnNodeDelete.ts +++ b/GUI/src/hooks/flow/useOnNodeDelete.ts @@ -236,7 +236,7 @@ export const useOnNodesDelete = () => { type: 'step', animated: true, deletable: false, - label: '+', + label: deleted[0].label ?? '+', }; setNodes((nds) => [...nds, ghostNode]); diff --git a/GUI/src/utils/mcq-flow-utils.ts b/GUI/src/utils/mcq-flow-utils.ts index f3b7b4972..feb4e878f 100644 --- a/GUI/src/utils/mcq-flow-utils.ts +++ b/GUI/src/utils/mcq-flow-utils.ts @@ -114,10 +114,15 @@ export const applySimpleConnection = ({ let finalNodes = nodes; let finalEdges = edges; + let preservedLabel: string | undefined; if (ghostEdges.length > 0) { const ghostNodeIds = new Set(ghostEdges.map((edge) => edge.target)); finalEdges = edges.filter((edge) => !ghostEdges.includes(edge)); finalNodes = nodes.filter((node) => !ghostNodeIds.has(node.id)); + if (ghostEdges.length === 1) { + const label = ghostEdges[0].label; + if (typeof label === 'string' && label !== '+') preservedLabel = label; + } } finalEdges = [ @@ -127,6 +132,7 @@ export const applySimpleConnection = ({ source, target, type: 'step', + ...(preservedLabel === undefined ? {} : { label: preservedLabel }), }, ];