mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: replace nodeCreated with loadedGraphNode for LoraManager nodes
- Change lifecycle hook from nodeCreated to loadedGraphNode in Lora Loader, Lora Stacker, and TriggerWord Toggle nodes - Remove requestAnimationFrame wrappers as loadedGraphNode ensures proper initialization timing - Maintain same functionality for restoring saved values and widget initialization - Improves reliability by using the appropriate node lifecycle event
This commit is contained in:
@@ -229,9 +229,8 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async nodeCreated(node) {
|
async loadedGraphNode(node) {
|
||||||
if (node.comfyClass == "Lora Loader (LoraManager)") {
|
if (node.comfyClass == "Lora Loader (LoraManager)") {
|
||||||
requestAnimationFrame(async () => {
|
|
||||||
// Restore saved value if exists
|
// Restore saved value if exists
|
||||||
let existingLoras = [];
|
let existingLoras = [];
|
||||||
if (node.widgets_values && node.widgets_values.length > 0) {
|
if (node.widgets_values && node.widgets_values.length > 0) {
|
||||||
@@ -242,7 +241,6 @@ app.registerExtension({
|
|||||||
// Merge the loras data
|
// Merge the loras data
|
||||||
const mergedLoras = mergeLoras(node.widgets[0].value, existingLoras);
|
const mergedLoras = mergeLoras(node.widgets[0].value, existingLoras);
|
||||||
node.lorasWidget.value = mergedLoras;
|
node.lorasWidget.value = mergedLoras;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -154,9 +154,8 @@ app.registerExtension({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async nodeCreated(node) {
|
async loadedGraphNode(node) {
|
||||||
if (node.comfyClass == "Lora Stacker (LoraManager)") {
|
if (node.comfyClass == "Lora Stacker (LoraManager)") {
|
||||||
requestAnimationFrame(async () => {
|
|
||||||
// Restore saved value if exists
|
// Restore saved value if exists
|
||||||
let existingLoras = [];
|
let existingLoras = [];
|
||||||
if (node.widgets_values && node.widgets_values.length > 0) {
|
if (node.widgets_values && node.widgets_values.length > 0) {
|
||||||
@@ -167,7 +166,6 @@ app.registerExtension({
|
|||||||
// Merge the loras data
|
// Merge the loras data
|
||||||
const mergedLoras = mergeLoras(node.widgets[0].value, existingLoras);
|
const mergedLoras = mergeLoras(node.widgets[0].value, existingLoras);
|
||||||
node.lorasWidget.value = mergedLoras;
|
node.lorasWidget.value = mergedLoras;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ app.registerExtension({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async nodeCreated(node) {
|
async loadedGraphNode(node) {
|
||||||
if (node.comfyClass === "TriggerWord Toggle (LoraManager)") {
|
if (node.comfyClass === "TriggerWord Toggle (LoraManager)") {
|
||||||
// Enable widget serialization
|
// Enable widget serialization
|
||||||
node.serialize_widgets = true;
|
node.serialize_widgets = true;
|
||||||
@@ -71,8 +71,6 @@ app.registerExtension({
|
|||||||
"shape": 7 // 7 is the shape of the optional input
|
"shape": 7 // 7 is the shape of the optional input
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for node to be properly initialized
|
|
||||||
requestAnimationFrame(async () => {
|
|
||||||
// Get the wheel sensitivity setting
|
// Get the wheel sensitivity setting
|
||||||
const wheelSensitivity = getWheelSensitivity();
|
const wheelSensitivity = getWheelSensitivity();
|
||||||
|
|
||||||
@@ -202,7 +200,6 @@ app.registerExtension({
|
|||||||
});
|
});
|
||||||
return transformedValue;
|
return transformedValue;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -107,9 +107,8 @@ app.registerExtension({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async nodeCreated(node) {
|
async loadedGraphNode(node) {
|
||||||
if (node.comfyClass == "WanVideo Lora Select (LoraManager)") {
|
if (node.comfyClass == "WanVideo Lora Select (LoraManager)") {
|
||||||
requestAnimationFrame(async () => {
|
|
||||||
// Restore saved value if exists
|
// Restore saved value if exists
|
||||||
let existingLoras = [];
|
let existingLoras = [];
|
||||||
if (node.widgets_values && node.widgets_values.length > 0) {
|
if (node.widgets_values && node.widgets_values.length > 0) {
|
||||||
@@ -120,7 +119,6 @@ app.registerExtension({
|
|||||||
// Merge the loras data
|
// Merge the loras data
|
||||||
const mergedLoras = mergeLoras(node.widgets[2].value, existingLoras);
|
const mergedLoras = mergeLoras(node.widgets[2].value, existingLoras);
|
||||||
node.lorasWidget.value = mergedLoras;
|
node.lorasWidget.value = mergedLoras;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user