When you use the Legend component from the graphin library (not the graphin-components package) and you pass bindType='edge' it throws an exception onClick because the click handler assumes the legend items are related to a node.
You can see the bug here in the Legend/Node.tsx file.
The assumption that the item is an INode is the problem here since an IEdge would not have the getEdges function.
It results in an error like this
TypeError: item.getEdges is not a function
Secondarily, if you use bindType as node the click handler breaks with a different error
TypeError: onChange is not a function
Update: This callback was introduced in this commit
Describe the bug
When you use the
Legend
component from thegraphin
library (not thegraphin-components
package) and you passbindType='edge'
it throws an exception onClick because the click handler assumes the legend items are related to a node. You can see the bug here in the Legend/Node.tsx file.The assumption that the item is an
INode
is the problem here since anIEdge
would not have thegetEdges
function. It results in an error like thisTypeError: item.getEdges is not a function
Secondarily, if you use
bindType
asnode
the click handler breaks with a different errorTypeError: onChange is not a function
Update: This callback was introduced in this commit
Your Example Website or App
https://codesandbox.io/s/legend-bug-repro-package-2-0pzsjd?file=/App.tsx
Steps to Reproduce the Bug or Issue
Open the sandbox Click a legend item to filter
NOTE: if you switch the
bindType
tonode
the click handler throws a different errorExpected behavior
Should be able to have a legend for either edges or nodes and be able to filter them on the graph accordingly.
Screenshots or Videos
Platform
Additional context
No response