mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 14:27:40 +00:00
- Follow-up on #781 - Fixes regression when reconnecting a reroute chain from an input
This commit is contained in:
@@ -342,18 +342,24 @@ export class LinkConnector {
|
||||
if (newLink) this.events.dispatch("input-moved", renderLink)
|
||||
} else {
|
||||
const { node: outputNode, fromSlot, fromReroute } = renderLink
|
||||
// Connect to yourself
|
||||
if (fromReroute?.id === reroute.id) return
|
||||
// Identical link
|
||||
if (fromReroute?.id != null && fromReroute.id === reroute.parentId) return
|
||||
|
||||
const reroutes = reroute.getReroutes()
|
||||
if (reroutes === null) throw new Error("Reroute loop detected.")
|
||||
|
||||
if (reroutes) {
|
||||
if (reroutes && fromReroute?.id != null) {
|
||||
for (const r of reroutes) {
|
||||
if (r.id === fromReroute?.id) break
|
||||
if (r.id === fromReroute.id) break
|
||||
if (r.id === reroute.id) {
|
||||
throw new Error("Cannot connect to reroute that is a parent of the reroute being connected to.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reroutes) {
|
||||
for (const reroute of reroutes.slice(0, -1).reverse()) {
|
||||
if (reroute.id === fromReroute?.id) break
|
||||
reroute.remove()
|
||||
|
||||
Reference in New Issue
Block a user