update(graph): mutate elements arr on updateEdge

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-25 15:16:47 +01:00
parent bd140f1549
commit 6c3bce88a7

View File

@@ -136,7 +136,7 @@ export const updateEdge = (oldEdge: Edge, newConnection: Connection, elements: E
sourceHandle: newConnection.sourceHandle,
targetHandle: newConnection.targetHandle,
}
elements.splice(elements.indexOf(foundEdge), 1, edge)
return elements.filter((e) => e.id !== oldEdge.id).concat(edge)
}