warning: Key error on same link with different link types ?
See original GitHub issueIs your feature request related to a problem? Please describe.
Warning: Encountered two children with the same key, `n7,n6`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
in g (created by Graph)
in svg (created by Graph)
in div (created by Graph)
in Graph (at visualization.js:46)
in div (at visualization.js:45)
in Visualization (at graph.js:49)
in div (at graph.js:47)
in section (at graph.js:24)
in Graph (at App.js:34)
in main (at layout.js:149)
in div (at layout.js:100)
in Layout (at App.js:33)
in ApolloProvider (at App.js:32)
in App (at src/index.js:8)
I get this key error, on the same edge with different type i.e line and curve_full for eg: This is likely because the keys are named based on the link however these links based on the type should be treated separately to avoid this warning.
Describe the solution you’d like A possible solution would be to attach type of the link with the keys or attach some unique id here in case if several links on the same edge are defined(This is not currently possible i think which should be also another feature i would like to see).
Describe your use case I am building a network graph that consists of local and global links and has to be defined distinctively to identify how are the messages are being passed i.e locally or globally.
Describe alternatives you’ve considered I tried to inverse the position of source and target but this is really hacky and I don’t like this solution
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
@gopherine Would this be an
id
defined by the client-side? Meaning, you as a developer usingreact-d3-graph
would have the responsibility of assigning the right id per each link? Or do you still think that is something that we should figure out internally within the library itself?yes, this would fix my issue for now, but then potentially the same two nodes can have not just two but even more edges for example - I am working on an algorithm where,I have three different types of edges global hidden and local edge. This would be some kind of major change I think so as each edge on the same node can be detected individually also without key error it is highly possible that they might have same edge type as well in some cases, in this case, appending type to link is not a long term solution.
Thinking through I assume that also assigning a link id and using that as a key would be a much better approach with each link having a unique id assigned.