feat(comfyui): fix trigger word toggle widget initialization

Change from loadedGraphNode to nodeCreated lifecycle method to ensure proper widget initialization timing. Wrap widget creation and highlight logic in requestAnimationFrame to prevent race conditions with node setup. This ensures the trigger word toggle widget functions correctly when nodes are created.
This commit is contained in:
Will Miao
2025-11-08 19:39:25 +08:00
parent 5ee93a27ee
commit 837bb17b08

View File

@@ -62,7 +62,7 @@ app.registerExtension({
}); });
}, },
async loadedGraphNode(node) { async nodeCreated(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,6 +71,8 @@ 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();
@@ -200,6 +202,7 @@ app.registerExtension({
}); });
return transformedValue; return transformedValue;
}; };
});
} }
}, },