Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/lib/litegraph/src/LGraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { LayoutSource } from '@/renderer/core/layout/types'
import { adjustColor } from '@/utils/colorUtil'
import type { ColorAdjustOptions } from '@/utils/colorUtil'

import { SUBGRAPH_OUTPUT_ID } from '@/lib/litegraph/src/constants'
import type { DragAndScale } from './DragAndScale'
import type { LGraph } from './LGraph'
import { BadgePosition, LGraphBadge } from './LGraphBadge'
Expand Down Expand Up @@ -45,8 +46,8 @@ import type {
Rect,
Size
} from './interfaces'
import { LiteGraph } from './litegraph'
import type { LGraphNodeConstructor, Subgraph, SubgraphNode } from './litegraph'
import { LiteGraph, Subgraph } from './litegraph'
import type { LGraphNodeConstructor, SubgraphNode } from './litegraph'
import {
createBounds,
isInRect,
Expand Down Expand Up @@ -3062,6 +3063,17 @@ export class LGraphNode
for (const link_id of links) {
const link_info = graph._links.get(link_id)
if (!link_info) continue
if (
link_info.target_id === SUBGRAPH_OUTPUT_ID &&
graph instanceof Subgraph
) {
const targetSlot = graph.outputNode.slots[link_info.target_slot]
if (targetSlot) {
targetSlot.linkIds.length = 0
} else {
console.error('Missing subgraphOutput slot when disconnecting link')
}
}

const target = graph.getNodeById(link_info.target_id)
graph._version++
Expand Down
1 change: 1 addition & 0 deletions src/lib/litegraph/src/subgraph/SubgraphOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class SubgraphOutput extends SubgraphSlot {
//should never have more than one connection
for (const linkId of this.linkIds) {
const link = subgraph.links[linkId]
if (!link) continue
subgraph.removeLink(linkId)
const { output, outputNode } = link.resolve(subgraph)
if (output)
Expand Down
Loading