Legend.Node in Graphin package assumes bindType is Node in click handler. Throws item.getEdges
is not a function error on item click.
#472
Labels
bug
Something isn't working
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 this
TypeError: 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
The text was updated successfully, but these errors were encountered: