From a0b50dcf15c9d67a327ac3b6812969dd6f3db705 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Mon, 2 Dec 2024 01:31:12 +0000 Subject: [PATCH] Fix cloning pinned nodes (#364) --- src/LGraphNode.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LGraphNode.ts b/src/LGraphNode.ts index ce3af90..2fa439c 100644 --- a/src/LGraphNode.ts +++ b/src/LGraphNode.ts @@ -2698,10 +2698,10 @@ export class LGraphNode implements Positionable, IPinnable { * Toggles pinned state if no value is provided. */ pin(v?: boolean): void { - this.graph._version++ - this.flags.pinned = v === undefined - ? !this.flags.pinned - : v + if (this.graph) { + this.graph._version++ + } + this.flags.pinned = v ?? !this.flags.pinned this.resizable = !this.pinned // Delete the flag if unpinned, so that we don't get unnecessary // flags.pinned = false in serialized object.