From 65230178151d61060868d4fde669bc6b49de4b0f Mon Sep 17 00:00:00 2001 From: milanofthe Date: Tue, 15 Sep 2026 18:03:11 +0200 Subject: [PATCH] Refresh canvas nodes when a port is renamed --- src/lib/components/FlowCanvas.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/components/FlowCanvas.svelte b/src/lib/components/FlowCanvas.svelte index 3883e38a..f01a132a 100644 --- a/src/lib/components/FlowCanvas.svelte +++ b/src/lib/components/FlowCanvas.svelte @@ -46,7 +46,7 @@ import { createEdgeHighlighter } from '$lib/stores/edgeHighlight'; import { CANVAS_MIN_ZOOM } from '$lib/constants/layout'; import { shallowEqualArray, shallowEqualRecord } from '$lib/utils/shallowEqual'; - import type { NodeInstance, Connection, Annotation } from '$lib/nodes/types'; + import type { NodeInstance, Connection, Annotation, PortInstance } from '$lib/nodes/types'; import type { EventInstance } from '$lib/events/types'; // Canvas utilities @@ -151,6 +151,10 @@ // Track port counts to detect changes - used to force node re-renders let portCounts = new Map(); + /** Port names by position; Interface ports are derived anew on every read, so references can't be compared */ + const samePortNames = (a: PortInstance[], b: PortInstance[]) => + a.length === b.length && a.every((port, i) => port.name === b[i].name); + // Track nodes that need internal updates (will be processed by FlowUpdater) let pendingNodeUpdates: string[] = $state([]); @@ -455,6 +459,7 @@ } if (currentData.name !== gn.name) return true; if (currentData.color !== gn.color) return true; + if (!samePortNames(currentData.inputs, gn.inputs) || !samePortNames(currentData.outputs, gn.outputs)) return true; if (!shallowEqualRecord(currentData.params, gn.params)) return true; if (!shallowEqualArray(currentData.pinnedParams, gn.pinnedParams)) return true; return false;