Fix prototype editing to connect nodes correctly

This commit is contained in:
Hazem Krimi
2023-04-14 21:18:52 +01:00
parent 9967dc9d6a
commit 7fd874caf5
+6 -6
View File
@@ -118,7 +118,7 @@ const Prototype = () => {
}, [id]); }, [id]);
useEffect(() => { useEffect(() => {
// if (template && template.features) { if (template && template.features) {
const initialNodes = template?.features?.map((feature, index) => ({ const initialNodes = template?.features?.map((feature, index) => ({
id: feature.id, id: feature.id,
type: 'featureCard', type: 'featureCard',
@@ -131,7 +131,7 @@ const Prototype = () => {
})); }));
if (initialNodes) setNodes(initialNodes); if (initialNodes) setNodes(initialNodes);
// } }
if (prototype) { if (prototype) {
const initialEdges: Array<Edge> = []; const initialEdges: Array<Edge> = [];
@@ -159,12 +159,12 @@ const Prototype = () => {
const handleEditPrototype = () => { const handleEditPrototype = () => {
if (editing) { if (editing) {
const prototypeInput = nodes const prototypeInput = edges
.map((node) => ({ .map((edge) => ({
featureId: node.id, featureId: edge.source,
connections: [ connections: [
{ {
to: node.id, to: edge.target,
releations: { back: false, forword: true }, releations: { back: false, forword: true },
}, },
], ],