diff --git a/execution.py b/execution.py index 6fd96141a..06a1f40c7 100644 --- a/execution.py +++ b/execution.py @@ -564,7 +564,7 @@ class PromptQueue: prompt = self.currently_running.pop(item_id) self.history[prompt[1]] = { "prompt": prompt, "outputs": {} } for o in outputs: - self.history[prompt[1]]["outputs"][o] = outputs[o] + self.history[prompt[1]]["outputs"][o] = outputs[o] self.server.queue_updated() def get_current_queue(self): diff --git a/web/scripts/app.js b/web/scripts/app.js index 6f4c6bd30..66504d326 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -353,28 +353,34 @@ export class ComfyApp { node.prototype.onDrawBackground = function (ctx) { if (!this.flags.collapsed) { - const output = app.nodeOutputs[this.id + ""]; - if (output && output.images) { - if (this.images !== output.images) { - this.images = output.images; - this.imgs = null; - this.imageIndex = null; - Promise.all( - output.images.map((src) => { - return new Promise((r) => { - const img = new Image(); - img.onload = () => r(img); - img.onerror = () => r(null); - img.src = "/view?" + new URLSearchParams(src).toString(); - }); - }) - ).then((imgs) => { - if (this.images === output.images) { - this.imgs = imgs.filter(Boolean); - this.setSizeForImage?.(); - app.graph.setDirtyCanvas(true); - } - }); + // Outputs returned by the frontend for each node are a list, one for each combinatorial batch run. + // With no combinatorial outputs, it's a list of length 1. + // For now select only the first batch output. + const batchOutputs = app.nodeOutputs[this.id + ""]; + if (batchOutputs && batchOutputs.length > 0) { + const output = batchOutputs[0]; + if (output && output.images) { + if (this.images !== output.images) { + this.images = output.images; + this.imgs = null; + this.imageIndex = null; + Promise.all( + output.images.map((src) => { + return new Promise((r) => { + const img = new Image(); + img.onload = () => r(img); + img.onerror = () => r(null); + img.src = "/view?" + new URLSearchParams(src).toString(); + }); + }) + ).then((imgs) => { + if (this.images === output.images) { + this.imgs = imgs.filter(Boolean); + this.setSizeForImage?.(); + app.graph.setDirtyCanvas(true); + } + }); + } } }