vue-flow icon indicating copy to clipboard operation
vue-flow copied to clipboard

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

Open SelfMade2001 opened this issue 5 months ago • 1 comments

Is there an existing issue for this?

  • [x] 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.

SelfMade2001 avatar May 20 '25 13:05 SelfMade2001