fix: Update workflow in place instead of creating new tab for resolve and auto-resolve
This commit is contained in:
+35
-8
@@ -628,17 +628,44 @@ class LinkerManagerDialog extends ComfyDialog {
|
||||
|
||||
/**
|
||||
* Update workflow in ComfyUI's UI/memory
|
||||
* Updates the current workflow in place instead of creating a new tab
|
||||
*/
|
||||
async updateWorkflowInComfyUI(workflow) {
|
||||
if (app && app.loadGraphData) {
|
||||
try {
|
||||
await app.loadGraphData(workflow, false, false);
|
||||
} catch (error) {
|
||||
console.error('Model Linker: Error updating workflow in ComfyUI:', error);
|
||||
throw error;
|
||||
if (!app || !app.graph) {
|
||||
console.warn('Model Linker: Could not update workflow - app or app.graph not available');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Method 1: Try to directly update the current graph using configure
|
||||
// This is the most direct way to update in place
|
||||
if (app.graph && typeof app.graph.configure === 'function') {
|
||||
app.graph.configure(workflow);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.warn('Model Linker: Could not update workflow - app.loadGraphData not available');
|
||||
|
||||
// Method 2: Try deserialize to update the graph in place
|
||||
if (app.graph && typeof app.graph.deserialize === 'function') {
|
||||
app.graph.deserialize(workflow);
|
||||
return;
|
||||
}
|
||||
|
||||
// Method 3: Use loadGraphData with explicit parameters to update current tab
|
||||
// The key is to NOT create a new workflow - pass null or undefined for the workflow parameter
|
||||
// clean=false means don't clear the graph first
|
||||
// restore_view=false means don't restore the viewport
|
||||
// workflow=null means update current workflow instead of creating new one
|
||||
if (app.loadGraphData) {
|
||||
// Try with null as 4th parameter first
|
||||
await app.loadGraphData(workflow, false, false, null);
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn('Model Linker: No method available to update workflow');
|
||||
} catch (error) {
|
||||
console.error('Model Linker: Error updating workflow in ComfyUI:', error);
|
||||
// Don't throw - allow the workflow update to continue even if UI update fails
|
||||
// The backend has already updated the workflow data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user