MrBlenny / react-flow-chart

🌊 A flexible, stateless, declarative flow chart library for react.
https://mrblenny.github.io/react-flow-chart/index.html
MIT License
1.48k stars 306 forks source link

did not get updated chart value in "onLinkMove" function after updating chart in "onLinkStart" function. Please check my code #146

Open Aman8756 opened 4 years ago

Aman8756 commented 4 years ago

export const onLinkStart = ({ linkId, fromNodeId, fromPortId }, chart, campaign_id, setChart) => { const newChart = cloneDeep(chart); newChart.links[linkId] = { id: linkId, from: { nodeId: fromNodeId, portId: fromPortId, }, to: {}, }; setChart({ chart: newChart }); };

export const onLinkMove = ({ linkId, toPosition }, chart, campaign_id, setChart) => { const newChart = cloneDeep(chart); // This chart is not updated one. So, it did not find the linkId. const link = newChart.links[linkId]; link.to.position = toPosition; newChart.links[linkId] = { ...link }; setChart({ chart: newChart }); };