react-flow-chart
react-flow-chart copied to clipboard
did not get updated chart value in "onLinkMove" function after updating chart in "onLinkStart" function. Please check my code
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 }); };