react-d3-graph icon indicating copy to clipboard operation
react-d3-graph copied to clipboard

d3 config behaviour differs after graph is rerendered

Open StraightOuttaCrompton opened this issue 5 years ago • 8 comments

Describe the bug The behaviour of a graph with the d3 config set appears to change after a rerender.

To Reproduce Steps to reproduce the behavior:

  1. Clone the repository at https://github.com/StraightOuttaCrompton/react-d3-graph-rearrange-issue
  2. Follow bug replication instructions in README

Expected behavior On graph re-render, d3 config should have no impact on appearance change of graph.

StraightOuttaCrompton avatar Dec 19 '19 17:12 StraightOuttaCrompton

I have noticed that this issue has been touched upon before in issue https://github.com/danielcaldas/react-d3-graph/issues/162

In the edit @sauln says

It appears that when there is a parent state change and the graph is rerendered, the graph has considerably different configurations, specifically w.r.t. the d3 configs. This results in the graph drastically changing its appearance.

@danielcaldas says

I would ask you to open it in a separate issue

However I could not find the separate issue

StraightOuttaCrompton avatar Dec 19 '19 17:12 StraightOuttaCrompton

Hey there @StraightOuttaCrompton, I would kindly ask you to check whether your issue is somewhat related to https://github.com/danielcaldas/react-d3-graph/issues/274#issuecomment-565372716. If so a Pull Request has recently been merged to address the issue.

danielcaldas avatar Jan 11 '20 16:01 danielcaldas

I have been having a look at this today. It doesn't seem related to https://github.com/danielcaldas/react-d3-graph/issues/274. I am using https://github.com/danielcaldas/react-d3-graph/tree/4ecf18cd19d84192658a4886a0d0b6a84cc70a3f and I still experience the same problem.

I am unsure of where the problem is coming from, but I suspect it is to do with the initializeGraphState call in Graph.jsx. Nodes in the state.d3Nodes object have different x and y values to that in the this.state.d3Nodes object.

I had a look at the initializeGraphState function but had no idea how to proceed?

@danielcaldas - What are your thoughts? Do you think I'm digging in the right are?

StraightOuttaCrompton avatar Jan 29 '20 17:01 StraightOuttaCrompton

Yes, @StraightOuttaCrompton I think you're digging into the right way. Sorry, I don't have currently the time to look into it. Could you tell me if this is still an issue for you? Have you found an workaround for this? Any feedback is much appreciated. Thanks

danielcaldas avatar Mar 01 '20 04:03 danielcaldas

Yeah, this is still an issue for me. I also haven't had time to look into it further, but I hope to as soon as I can.

StraightOuttaCrompton avatar Mar 16 '20 21:03 StraightOuttaCrompton

Thanks for following up @StraightOuttaCrompton, keep us up to date. Cheers!

danielcaldas avatar Mar 29 '20 09:03 danielcaldas

I'm still running into this issue

jadenmazzone avatar Jun 09 '21 20:06 jadenmazzone

Any solutions for this?

cemysf avatar Dec 22 '21 12:12 cemysf