-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding nodes? #7
Comments
Hey nice stuff! Some people have already mentioned to me that support for adding nodes would be awesome. Still, the component architecture is not yet ready to have this behavior 😩. Still your suggestion is the first step for supporting graph data update, that is rebuilding the nodes and links model each time an update is passed to the component. There is a problem with your approach tough, each time a _tick occurs the whole model is rebuilt (since it is called inside componentDidUpdate lifecycle hook). I will get rid of the componentDidUpdate soon, but for sake of performance I will only build the model in componentWillReceiveProps. Another step that is needed in order to node addition to work properly run the block that is inside componentDidMount in order to make D3 aware of the new graph data structure. |
I definitely imagined that the architecture would fight back a change like this, and totally understand the mistake now involving |
Now data updates are reflected on the graph 😃 |
So I started off with the example in the README, and added a simple button that adds a node and link on click:
But this does not add the node to the graph. It seems like even though the data state is definitely being updated, the nodes aren't being 'processed' by D3 (doesn't have all of the coordinates/D3 specific data added to them). Could maybe be an issue of when D3 is called with the data? Should probably be called whenever there is an update?
The text was updated successfully, but these errors were encountered: