From 86d1c2a93a2b0773718533fa3a040c30f9fae993 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 7 May 2025 21:18:42 +1000 Subject: [PATCH] Workaround crash on load from custom nodes (#1023) --- src/widgets/BaseWidget.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/widgets/BaseWidget.ts b/src/widgets/BaseWidget.ts index b5d0b469c..1bd096b27 100644 --- a/src/widgets/BaseWidget.ts +++ b/src/widgets/BaseWidget.ts @@ -75,7 +75,12 @@ export abstract class BaseWidget implements I onPointerDown?(pointer: CanvasPointer, node: LGraphNode, canvas: LGraphCanvas): boolean constructor(widget: TWidget) { - Object.assign(this, widget) + // TODO: Resolve this workaround. Ref: https://github.com/Comfy-Org/litegraph.js/issues/1022 + // @ts-expect-error Prevent naming conflicts with custom nodes. + // eslint-disable-next-line unused-imports/no-unused-vars + const { outline_color, background_color, height, text_color, secondary_text_color, disabledTextColor, displayName, displayValue, labelBaseline, ...safeValues } = widget + + Object.assign(this, safeValues) this.name = widget.name this.options = widget.options this.type = widget.type