Prevent connecting nodes with the same ID

This commit is contained in:
Debadutta Panda 2025-02-07 02:32:50 +05:30
parent 9694c8bdfa
commit 480cd0b8ef

View File

@ -3070,6 +3070,10 @@ RED.nodes = (function() {
}) })
} }
targetNodes.forEach(target => { targetNodes.forEach(target => {
// Two nodes with the same ID cannot be connected to each other.
if(sourceNode.id === target.id) {
return
}
let linkId = `${sourceNode.id}[${inLink.sourcePort}] -> ${target.id}` let linkId = `${sourceNode.id}[${inLink.sourcePort}] -> ${target.id}`
if (!createdLinkIds.has(linkId)) { if (!createdLinkIds.has(linkId)) {
createdLinkIds.add(linkId); createdLinkIds.add(linkId);