From 477d498d6b8e764fc85f001f10d89488d7743fb0 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 26 Feb 2025 03:33:21 +1100 Subject: [PATCH] [API] Remove unused: optional_inputs & outputs (#597) Code search shows zero usage. If kept, typing properly would require effort. Removed: - `LGraphNode.optional_inputs` - `LGraphNode.optional_outputs` --- src/LGraphCanvas.ts | 14 ++++++++------ src/LGraphNode.ts | 4 ---- test/__snapshots__/ConfigureGraph.test.ts.snap | 6 ------ test/__snapshots__/LGraph.test.ts.snap | 6 ------ test/__snapshots__/LGraph_constructor.test.ts.snap | 6 ------ 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index cb3390152..6d8c85053 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -893,7 +893,8 @@ export class LGraphCanvas implements ConnectionColorContext { /** @param options Parameter is never used */ static showMenuNodeOptionalInputs( v: unknown, - options: INodeInputSlot[], + /** Unused - immediately overwritten */ + _options: boolean, e: MouseEvent, prev_menu: ContextMenu, node: LGraphNode, @@ -905,9 +906,9 @@ export class LGraphCanvas implements ConnectionColorContext { const canvas = LGraphCanvas.active_canvas const ref_window = canvas.getCanvasWindow() - options = node.onGetInputs + const options = node.onGetInputs ? node.onGetInputs() - : node.optional_inputs + : undefined let entries: IOptionalSlotData[] = [] if (options) { @@ -973,7 +974,8 @@ export class LGraphCanvas implements ConnectionColorContext { /** @param options Parameter is never used */ static showMenuNodeOptionalOutputs( v: unknown, - options: INodeOutputSlot[], + /** Unused - immediately overwritten */ + _options: INodeOutputSlot[], e: unknown, prev_menu: ContextMenu, node: LGraphNode, @@ -984,9 +986,9 @@ export class LGraphCanvas implements ConnectionColorContext { const canvas = LGraphCanvas.active_canvas const ref_window = canvas.getCanvasWindow() - options = node.onGetOutputs + const options = node.onGetOutputs ? node.onGetOutputs() - : node.optional_outputs + : undefined let entries: IOptionalSlotData[] = [] if (options) { diff --git a/src/LGraphNode.ts b/src/LGraphNode.ts index edf59f305..eb2ee89ea 100644 --- a/src/LGraphNode.ts +++ b/src/LGraphNode.ts @@ -279,10 +279,6 @@ export class LGraphNode implements Positionable, IPinnable, IColorable { _shape?: RenderShape mouseOver?: IMouseOverData redraw_on_mouse?: boolean - // Appears unused - optional_inputs? - // Appears unused - optional_outputs? resizable?: boolean clonable?: boolean _relative_id?: number diff --git a/test/__snapshots__/ConfigureGraph.test.ts.snap b/test/__snapshots__/ConfigureGraph.test.ts.snap index 1f7a5ebf0..b6c0bc2cf 100644 --- a/test/__snapshots__/ConfigureGraph.test.ts.snap +++ b/test/__snapshots__/ConfigureGraph.test.ts.snap @@ -82,8 +82,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -148,8 +146,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -215,8 +211,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, diff --git a/test/__snapshots__/LGraph.test.ts.snap b/test/__snapshots__/LGraph.test.ts.snap index efa37d08b..84aea52ad 100644 --- a/test/__snapshots__/LGraph.test.ts.snap +++ b/test/__snapshots__/LGraph.test.ts.snap @@ -84,8 +84,6 @@ LGraph { "lostFocusAt": undefined, "mode": undefined, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -152,8 +150,6 @@ LGraph { "lostFocusAt": undefined, "mode": undefined, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -221,8 +217,6 @@ LGraph { "lostFocusAt": undefined, "mode": undefined, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, diff --git a/test/__snapshots__/LGraph_constructor.test.ts.snap b/test/__snapshots__/LGraph_constructor.test.ts.snap index 432245ebc..80151bf91 100644 --- a/test/__snapshots__/LGraph_constructor.test.ts.snap +++ b/test/__snapshots__/LGraph_constructor.test.ts.snap @@ -82,8 +82,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -148,8 +146,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {}, @@ -215,8 +211,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "optional_inputs": undefined, - "optional_outputs": undefined, "order": 0, "outputs": [], "properties": {},