diff --git a/src_web/comfyui/feature_import_individual_nodes.ts b/src_web/comfyui/feature_import_individual_nodes.ts index 170581d..658d1d7 100644 --- a/src_web/comfyui/feature_import_individual_nodes.ts +++ b/src_web/comfyui/feature_import_individual_nodes.ts @@ -47,17 +47,20 @@ export async function importIndividualNodesInnerOnDragDrop(node: ComfyNode, e: D if (!handled && workflow) { const exact = (workflow.nodes || []).find((n) => n.id === node.id && n.type === node.type); if ( - exact && - exact.widgets_values?.length && + exact?.widgets_values?.length && confirm( "Found a node match from embedded workflow (same id & type) in this workflow. Would you like to set the widget values?", ) ) { - node.configure({ widgets_values: [...(exact?.widgets_values || [])] } as any); + node.configure({ + // Title is overridden if it's not supplied; set it to the current then. + title: node.title, + widgets_values: [...(exact?.widgets_values || [])] + } as any); handled = true; } } - if (!handled) { + if (!handled && workflow) { handled = !confirm( "No exact match found in workflow. Would you like to replace the whole workflow?", ); diff --git a/web/comfyui/feature_import_individual_nodes.js b/web/comfyui/feature_import_individual_nodes.js index 4e0468e..1471475 100644 --- a/web/comfyui/feature_import_individual_nodes.js +++ b/web/comfyui/feature_import_individual_nodes.js @@ -38,14 +38,16 @@ export async function importIndividualNodesInnerOnDragDrop(node, e) { const { workflow, prompt } = await tryToGetWorkflowDataFromEvent(e); if (!handled && workflow) { const exact = (workflow.nodes || []).find((n) => n.id === node.id && n.type === node.type); - if (exact && - ((_b = exact.widgets_values) === null || _b === void 0 ? void 0 : _b.length) && + if (((_b = exact === null || exact === void 0 ? void 0 : exact.widgets_values) === null || _b === void 0 ? void 0 : _b.length) && confirm("Found a node match from embedded workflow (same id & type) in this workflow. Would you like to set the widget values?")) { - node.configure({ widgets_values: [...((exact === null || exact === void 0 ? void 0 : exact.widgets_values) || [])] }); + node.configure({ + title: node.title, + widgets_values: [...((exact === null || exact === void 0 ? void 0 : exact.widgets_values) || [])] + }); handled = true; } } - if (!handled) { + if (!handled && workflow) { handled = !confirm("No exact match found in workflow. Would you like to replace the whole workflow?"); } return handled;