From 7fd874caf569108ae09ce440007f8614d3bb3923 Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Fri, 14 Apr 2023 21:18:52 +0100 Subject: [PATCH] Fix prototype editing to connect nodes correctly --- src/pages/Prototype/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/Prototype/index.tsx b/src/pages/Prototype/index.tsx index 8856c49..1faeb1a 100644 --- a/src/pages/Prototype/index.tsx +++ b/src/pages/Prototype/index.tsx @@ -118,7 +118,7 @@ const Prototype = () => { }, [id]); useEffect(() => { - // if (template && template.features) { + if (template && template.features) { const initialNodes = template?.features?.map((feature, index) => ({ id: feature.id, type: 'featureCard', @@ -131,7 +131,7 @@ const Prototype = () => { })); if (initialNodes) setNodes(initialNodes); - // } + } if (prototype) { const initialEdges: Array = []; @@ -159,12 +159,12 @@ const Prototype = () => { const handleEditPrototype = () => { if (editing) { - const prototypeInput = nodes - .map((node) => ({ - featureId: node.id, + const prototypeInput = edges + .map((edge) => ({ + featureId: edge.source, connections: [ { - to: node.id, + to: edge.target, releations: { back: false, forword: true }, }, ],