From 6f3f1f9f24e1b820bddc0d32d6aacab78add0e6a Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 20 Jul 2025 23:18:08 -0700 Subject: [PATCH] [fix] Change parentSubgraphNode type to NodeLike (#1142) --- src/types/widgets.ts | 5 ++++- src/widgets/BaseWidget.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/types/widgets.ts b/src/types/widgets.ts index b01a97bee..b9377d0d1 100644 --- a/src/types/widgets.ts +++ b/src/types/widgets.ts @@ -1,6 +1,7 @@ import type { CanvasColour, Point, RequiredProps, Size } from "../interfaces" import type { CanvasPointer, LGraphCanvas, LGraphNode } from "../litegraph" import type { CanvasPointerEvent } from "./events" +import type { NodeLike } from "./NodeLike" export interface IWidgetOptions { on?: string @@ -204,8 +205,10 @@ export interface IBaseWidget< /** * Reference to the subgraph container node when this widget is promoted from a subgraph. * This allows the widget to know which SubgraphNode it belongs to in the parent graph. + * @remarks This property is a runtime reference and should not be serialized. + * It will be undefined after deserialization and needs to be reconstructed. */ - parentSubgraphNode?: LGraphNode + parentSubgraphNode?: NodeLike // TODO: Confirm this format callback?( diff --git a/src/widgets/BaseWidget.ts b/src/widgets/BaseWidget.ts index 9cd66a729..d503a3f2c 100644 --- a/src/widgets/BaseWidget.ts +++ b/src/widgets/BaseWidget.ts @@ -1,6 +1,7 @@ import type { Point } from "@/interfaces" import type { CanvasPointer, LGraphCanvas, LGraphNode, Size } from "@/litegraph" import type { CanvasPointerEvent } from "@/types/events" +import type { NodeLike } from "@/types/NodeLike" import type { IBaseWidget } from "@/types/widgets" import { drawTextInArea } from "@/draw" @@ -60,7 +61,7 @@ export abstract class BaseWidget impl * Reference to the subgraph container node when this widget is promoted from a subgraph. * This allows the widget to know which SubgraphNode it belongs to in the parent graph. */ - parentSubgraphNode?: LGraphNode + parentSubgraphNode?: NodeLike linkedWidgets?: IBaseWidget[] name: string