Fix crash connecting to node with no slots (#644)

* Fix crash connecting to node with no slots

* Add playwright test

* Update test expectations [skip ci]

---------

Co-authored-by: huchenlei <chenlei.hu@mail.utoronto.ca>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
pythongosssss
2024-08-26 23:29:52 +01:00
committed by GitHub
parent 96d129e8a6
commit c604209f40
3 changed files with 14 additions and 0 deletions

View File

@@ -65,4 +65,16 @@ test.describe('Node search box', () => {
'auto-linked-node-batch.png'
)
})
test('Link release connecting to node with no slots', async ({
comfyPage
}) => {
await comfyPage.disconnectEdge()
await expect(comfyPage.searchBox.input).toHaveCount(1)
await comfyPage.page.locator('.p-chip-remove-icon').click()
await comfyPage.searchBox.fillAndSelectFirstNode('KSampler')
await expect(comfyPage.canvas).toHaveScreenshot(
'added-node-no-connection.png'
)
})
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -54,6 +54,8 @@ export class ConnectingLinkImpl implements ConnectingLink {
connectTo(newNode: LGraphNode) {
const newNodeSlots =
this.releaseSlotType === 'output' ? newNode.outputs : newNode.inputs
if (!newNodeSlots) return
const newNodeSlot = newNodeSlots.findIndex(
(slot: INodeSlot) =>
slot.type === this.type || slot.type === '*' || this.type === '*'