fix: resolve errors when converting ImageCrop node to subgraph (#8898)

## Summary

- Pass callback directly to addWidget instead of null to eliminate
'addWidget without a callback or property assigned' warning
- Serialize object widget values as plain objects in
LGraphNode.serialize to prevent DataCloneError when structuredClone
encounters Vue reactive proxies

## Screenshots (if applicable)
before

https://github.com/user-attachments/assets/af20bd84-3e0e-4eca-b095-eaf4d5bb6884

after


https://github.com/user-attachments/assets/5a17772e-04bc-4f3e-abec-78c540e0efa3

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8898-fix-resolve-errors-when-converting-ImageCrop-node-to-subgraph-3086d73d365081b2ae34db31225683ad)
by [Unito](https://www.unito.io)
This commit is contained in:
Terry Jia
2026-02-16 05:46:46 -05:00
committed by GitHub
parent 21cfd44a2d
commit 3d88d0a6ab
2 changed files with 15 additions and 13 deletions

View File

@@ -45,7 +45,15 @@ export const useBoundingBoxWidget = (): ComfyWidgetConstructorV2 => {
widgetType,
name,
{ ...defaultValue },
null,
() => {
for (let i = 0; i < fields.length; i++) {
const field = fields[i]
const subWidget = subWidgets[i]
if (subWidget) {
subWidget.value = widget.value[field]
}
}
},
{
serialize: true,
canvasOnly: false
@@ -58,16 +66,6 @@ export const useBoundingBoxWidget = (): ComfyWidgetConstructorV2 => {
const widget = rawWidget
widget.callback = () => {
for (let i = 0; i < fields.length; i++) {
const field = fields[i]
const subWidget = subWidgets[i]
if (subWidget) {
subWidget.value = widget.value[field]
}
}
}
for (const field of fields) {
const subWidget = node.addWidget(
'number',