mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +00:00
Warn users if calling connectSlots incorrectly (#724)
Prevents silent failures from going unnoticed.
This commit is contained in:
@@ -417,6 +417,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
|||||||
value: unknown,
|
value: unknown,
|
||||||
prev_value?: unknown,
|
prev_value?: unknown,
|
||||||
): boolean
|
): boolean
|
||||||
|
/** Called for each connection that is created, updated, or removed. This includes "restored" connections when deserialising. */
|
||||||
onConnectionsChange?(
|
onConnectionsChange?(
|
||||||
this: LGraphNode,
|
this: LGraphNode,
|
||||||
type: ISlotType,
|
type: ISlotType,
|
||||||
@@ -2456,9 +2457,15 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
|||||||
if (!graph) throw new NullGraphError()
|
if (!graph) throw new NullGraphError()
|
||||||
|
|
||||||
const outputIndex = this.outputs.indexOf(output)
|
const outputIndex = this.outputs.indexOf(output)
|
||||||
if (outputIndex === -1) return
|
if (outputIndex === -1) {
|
||||||
|
console.warn("connectSlots: output not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
const inputIndex = inputNode.inputs.indexOf(input)
|
const inputIndex = inputNode.inputs.indexOf(input)
|
||||||
if (inputIndex === -1) return
|
if (inputIndex === -1) {
|
||||||
|
console.warn("connectSlots: input not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// check targetSlot and check connection types
|
// check targetSlot and check connection types
|
||||||
if (!LiteGraph.isValidConnection(output.type, input.type)) {
|
if (!LiteGraph.isValidConnection(output.type, input.type)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user