Skip to content

🐛 [BUG]: is-valid-connection elements target and source Node switched; breaking change upgrading to version >= 1.41.7 #1855

@SelfMade2001

Description

@SelfMade2001

Is there an existing issue for this?

  • I have searched the existing issues and this is a new bug.

Current Behavior

<VueFlow
            :connection-mode="ConnectionMode.Strict"
            :is-valid-connection="validateConnection"
        >

In the following setup node1 only has a source handle and node2 only has a target handle.

Connecting node1 -> node2

const validateConnection = (connection, elements) => {
    console.log(elements.sourceNode.id) // node1
    console.log(elements.targetNode.id) // node2
}

Connecting node1 <- node2 (making the same connection but starting to drag from node2's target handle)

const validateConnection = (connection, elements) => {
    console.log(elements.sourceNode.id) // node2
    console.log(elements.targetNode.id) // node1
}

Expected Behavior

Connecting node1 -> node2

const validateConnection = (connection, elements) => {
    console.log(elements.sourceNode.id) // node1
    console.log(elements.targetNode.id) // node2
}

Connecting node1 <- node2 (making the same connection but starting to drag from node2's target handle)

const validateConnection = (connection, elements) => {
    console.log(elements.sourceNode.id) // node1
    console.log(elements.targetNode.id) // node2
}

When validating a connection it should not matter from which side the user starts to drag.

Steps To Reproduce

I am using ConnectionMode.Strict.
The bug is in every version >= 1.41.7

Minimal reproduction of the issue with CodeSandbox

No response

Relevant log output

Anything else?

I upgraded vue-flow from below 1.41.7 to the latest version. I tested all versions until I found that it still works in 1.41.6 but breaks in 1.41.7. The changelog did not mention this change, probably because it is a bug.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageAwaiting triage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions