Skip to content

addEdge passes targetID as both source and target to edge validation #296

@avinxshKD

Description

@avinxshKD

In 3-component.js, the addEdge method calls this.validiateEdge() with edgeData.targetID for both the sourceID and targetID parameters:

const message = this.validiateEdge(edgeLabel, edgeStyle,
    edgeData.targetID, edgeData.targetID, null, 'New');

The third argument should be edgeData.sourceID.

Steps to reproduce

  1. Define a custom edge validator that relies on the source node's label (e.g., reject edges originating from a specific node)
  2. Try to create an edge from that node to another node via the edge creation modal
  3. Observe that the validator sees the target node's label for both source and target, so it doesn't reject the edge

Expected behavior:
validiateEdge receives the actual source node ID so validators can correctly distinguish source from target

Actual behavior:
The target node's ID is passed as both sourceID and targetID, making source-aware validation logic ineffectiv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions