Show placeholder image when preview is disabled

When the preview is disabled in the canvas widget, a 1x1 transparent PNG placeholder image is now set to node.imgs. This prevents issues with missing images and ensures consistent UI behavior.
This commit is contained in:
Dariusz L
2025-07-23 18:28:31 +02:00
parent ffbd5bfe43
commit 60b6a9f932
3 changed files with 9 additions and 1 deletions

View File

@@ -538,6 +538,10 @@ async function createCanvasWidget(node, widget, app) {
const showPreviewWidget = node.widgets.find((w) => w.name === "show_preview");
if (showPreviewWidget && !showPreviewWidget.value) {
log.debug("Preview disabled, skipping updateOutput");
const PLACEHOLDER_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
const placeholder = new Image();
placeholder.src = PLACEHOLDER_IMAGE;
node.imgs = [placeholder];
return;
}
const triggerWidget = node.widgets.find((w) => w.name === "trigger");