reaviz / reagraph

🕸 WebGL Graph Visualizations for React. Maintained by @goodcodeus.
https://reagraph.dev
Apache License 2.0
660 stars 64 forks source link

Error when referencing the same node as target #234

Open jsjohann opened 5 months ago

jsjohann commented 5 months ago

Describe the bug

When referencing the same node as well as source and target in an edge, the edge isn't rendered and I get following error message in console:

THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.

Steps to Reproduce the Bug or Issue

    const nodes = [
        {
            id: '1',
            label: 'Node 1',
        },
    ];

    const edges = [
        {
            id: '1',
            source: '1',
            target: '1',
            label: 'Edge 1',
        },
    ];

    return (
        <GraphCanvas edges={edges} nodes={nodes} />
    )

Expected behavior

Ideally, there would be a support for self-referencing nodes/edges where the arrow basically targets the same node (see quick mockup).

Screenshots or Videos

image

Platform