mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
Review feedback
This commit is contained in:
@@ -910,7 +910,7 @@ export class LGraphNode
|
||||
const getNamedValues = () => {
|
||||
if (info.widgets_values_named) return info.widgets_values_named
|
||||
|
||||
const map = this.constructor.nodeData?.valueMigrationDict
|
||||
const map = this.constructor.nodeData?.fallbackWidgetsValuesNames
|
||||
if (!info.widgets_values || !map) return
|
||||
const namedValues: Record<string, TWidgetValue> = {}
|
||||
info.widgets_values.forEach((val, i) => {
|
||||
@@ -921,10 +921,10 @@ export class LGraphNode
|
||||
const namedValues = getNamedValues()
|
||||
if (namedValues && LiteGraph.namedValuesRestore) {
|
||||
for (const widget of this.widgets ?? []) {
|
||||
if (widget.name in namedValues) {
|
||||
widget.value = namedValues[widget.name]
|
||||
widget.callback?.(widget.value)
|
||||
}
|
||||
if (widget.serialize === false || !(widget.name in namedValues))
|
||||
continue
|
||||
|
||||
widget.value = namedValues[widget.name]
|
||||
}
|
||||
} else if (info.widgets_values) {
|
||||
let i = 0
|
||||
@@ -986,14 +986,14 @@ export class LGraphNode
|
||||
o.widgets_values_named = {}
|
||||
for (const [i, widget] of widgets.entries()) {
|
||||
if (widget.serialize === false) continue
|
||||
const val = widget?.value
|
||||
const val = widget.value
|
||||
// Ensure object values are plain (not reactive proxies) for structuredClone compatibility.
|
||||
const serialisedVal =
|
||||
val != null && typeof val === 'object'
|
||||
? JSON.parse(JSON.stringify(val))
|
||||
: (val ?? null)
|
||||
o.widgets_values[i] = serialisedVal
|
||||
if (val !== null) o.widgets_values_named[widget.name] = serialisedVal
|
||||
o.widgets_values_named[widget.name] = serialisedVal
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ export const zComfyNodeDef = z.object({
|
||||
essentials_category: z.string().optional(),
|
||||
/** Whether the blueprint is a global/installed blueprint (not user-created). */
|
||||
isGlobal: z.boolean().optional(),
|
||||
valueMigrationDict: z.array(z.string()).optional()
|
||||
fallbackWidgetsValuesNames: z.array(z.string()).optional()
|
||||
})
|
||||
|
||||
export const zAutogrowOptions = z.object({
|
||||
|
||||
Reference in New Issue
Block a user