mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
fix: resolve promoted widget slot with compressed target_slot
- resolveLegacyEntry now finds input by link ID instead of trusting target_slot - navigateIntoSubgraph clicks title button instead of dblclick on body Amp-Thread-ID: https://ampcode.com/threads/T-019c55f5-bf2b-7087-b0b8-0ac3be03c7c9 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -458,12 +458,13 @@ export class NodeReference {
|
||||
const nodePos = await this.getPosition()
|
||||
const nodeSize = await this.getSize()
|
||||
|
||||
// Try multiple positions to avoid DOM widget interference
|
||||
const clickPositions = [
|
||||
{ x: nodePos.x + nodeSize.width / 2, y: nodePos.y + titleHeight + 5 },
|
||||
{ x: nodePos.x + nodeSize.width / 2, y: nodePos.y + nodeSize.height / 2 },
|
||||
{ x: nodePos.x + 20, y: nodePos.y + titleHeight + 5 }
|
||||
]
|
||||
// Click the enter_subgraph title button (top-right of title bar).
|
||||
// This is more reliable than dblclick on the node body because
|
||||
// promoted DOM widgets can overlay the body and intercept events.
|
||||
const buttonPos = {
|
||||
x: nodePos.x + nodeSize.width - 15,
|
||||
y: nodePos.y - titleHeight / 2
|
||||
}
|
||||
|
||||
const checkIsInSubgraph = async () => {
|
||||
return this.comfyPage.page.evaluate(() => {
|
||||
@@ -473,20 +474,13 @@ export class NodeReference {
|
||||
}
|
||||
|
||||
await expect(async () => {
|
||||
for (const position of clickPositions) {
|
||||
// Clear any selection first
|
||||
await this.comfyPage.canvas.click({
|
||||
position: { x: 250, y: 250 },
|
||||
force: true
|
||||
})
|
||||
await this.comfyPage.nextFrame()
|
||||
await this.comfyPage.canvas.click({
|
||||
position: buttonPos,
|
||||
force: true
|
||||
})
|
||||
await this.comfyPage.nextFrame()
|
||||
|
||||
// Double-click to enter subgraph
|
||||
await this.comfyPage.canvas.dblclick({ position, force: true })
|
||||
await this.comfyPage.nextFrame()
|
||||
|
||||
if (await checkIsInSubgraph()) return
|
||||
}
|
||||
if (await checkIsInSubgraph()) return
|
||||
throw new Error('Not in subgraph yet')
|
||||
}).toPass({ timeout: 5000, intervals: [100, 200, 500] })
|
||||
}
|
||||
|
||||
@@ -72,11 +72,16 @@ function resolveLegacyEntry(
|
||||
const link = linkId != null ? subgraph.getLink(linkId) : undefined
|
||||
if (!link) return null
|
||||
|
||||
const resolved = link.resolve(subgraph)
|
||||
const inputWidgetName = resolved.input?.widget?.name
|
||||
if (!resolved.inputNode || !inputWidgetName) return null
|
||||
const inputNode = subgraph.getNodeById(link.target_id) ?? undefined
|
||||
if (!inputNode) return null
|
||||
|
||||
return [String(resolved.inputNode.id), inputWidgetName]
|
||||
// Find input by link ID rather than target_slot, since target_slot
|
||||
// can be unreliable in compressed workflows.
|
||||
const targetInput = inputNode.inputs?.find((inp) => inp.link === linkId)
|
||||
const inputWidgetName = targetInput?.widget?.name
|
||||
if (!inputWidgetName) return null
|
||||
|
||||
return [String(inputNode.id), inputWidgetName]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user