refactor(widget-serialization): remove dummy items from serialization which was a fix to ComfyUI issues

This commit is contained in:
Will Miao
2025-05-08 20:25:26 +08:00
parent 99463ad01c
commit 9169bbd04d
2 changed files with 2 additions and 11 deletions

View File

@@ -948,11 +948,7 @@ export function addLorasWidget(node, name, opts, callback) {
widget.callback = callback;
widget.serializeValue = () => {
// Add dummy items to avoid the 2-element serialization issue, a bug in comfyui
return [...widgetValue,
{ name: "__dummy_item1__", strength: 0, active: false, _isDummy: true },
{ name: "__dummy_item2__", strength: 0, active: false, _isDummy: true }
];
return widgetValue;
}
widget.onRemove = () => {

View File

@@ -220,13 +220,8 @@ export function addTagsWidget(node, name, opts, callback) {
// Set callback
widget.callback = callback;
// Add serialization method to avoid ComfyUI serialization issues
widget.serializeValue = () => {
// Add dummy items to avoid the 2-element serialization issue
return [...widgetValue,
{ text: "__dummy_item__", active: false, _isDummy: true },
{ text: "__dummy_item__", active: false, _isDummy: true }
];
return widgetValue
};
return { minWidth: 300, minHeight: defaultHeight, widget };