mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-16 16:32:34 +08:00
Fix reconnecting output links on convert to group
This commit is contained in:
parent
4c928d2371
commit
b6fb105b95
@ -132,6 +132,19 @@ describe("group node", () => {
|
||||
group.outputs["EmptyLatentImage LATENT"].connections.map((t) => [t.targetNode.id, t.targetInput.index])
|
||||
).toEqual([[nodes.sampler.id, 3]]);
|
||||
});
|
||||
|
||||
test("maintains all output links on conversion", async () => {
|
||||
const { ez, graph, app } = await start();
|
||||
const nodes = createDefaultWorkflow(ez, graph);
|
||||
const save2 = ez.SaveImage(...nodes.decode.outputs);
|
||||
const save3 = ez.SaveImage(...nodes.decode.outputs);
|
||||
const group = await convertToGroup(app, graph, "test", [nodes.sampler, nodes.decode]);
|
||||
expect(group.outputs[0].connections.length).toBe(3);
|
||||
expect(group.outputs[0].connections[0].targetNode.id).toBe(nodes.save.id);
|
||||
expect(group.outputs[0].connections[1].targetNode.id).toBe(save2.id);
|
||||
expect(group.outputs[0].connections[2].targetNode.id).toBe(save3.id);
|
||||
});
|
||||
|
||||
test("can be be converted back to nodes", async () => {
|
||||
const { ez, graph, app } = await start();
|
||||
const nodes = createDefaultWorkflow(ez, graph);
|
||||
|
||||
@ -259,7 +259,9 @@ class ConvertToGroupAction {
|
||||
if (!node.outputs) return;
|
||||
for (const output of node.outputs) {
|
||||
if (!output.links) continue;
|
||||
for (const l of output.links) {
|
||||
// Clone the links as they'll be changed if we reconnect
|
||||
const links = [...output.links];
|
||||
for (const l of links) {
|
||||
const link = app.graph.links[l];
|
||||
if (!link) continue;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user