|
46 | 46 | import { createEdgeHighlighter } from '$lib/stores/edgeHighlight'; |
47 | 47 | import { CANVAS_MIN_ZOOM } from '$lib/constants/layout'; |
48 | 48 | import { shallowEqualArray, shallowEqualRecord } from '$lib/utils/shallowEqual'; |
49 | | - import type { NodeInstance, Connection, Annotation } from '$lib/nodes/types'; |
| 49 | + import type { NodeInstance, Connection, Annotation, PortInstance } from '$lib/nodes/types'; |
50 | 50 | import type { EventInstance } from '$lib/events/types'; |
51 | 51 |
|
52 | 52 | // Canvas utilities |
|
151 | 151 | // Track port counts to detect changes - used to force node re-renders |
152 | 152 | let portCounts = new Map<string, { inputs: number; outputs: number }>(); |
153 | 153 |
|
| 154 | + /** Port names by position; Interface ports are derived anew on every read, so references can't be compared */ |
| 155 | + const samePortNames = (a: PortInstance[], b: PortInstance[]) => |
| 156 | + a.length === b.length && a.every((port, i) => port.name === b[i].name); |
| 157 | +
|
154 | 158 | // Track nodes that need internal updates (will be processed by FlowUpdater) |
155 | 159 | let pendingNodeUpdates: string[] = $state([]); |
156 | 160 |
|
|
455 | 459 | } |
456 | 460 | if (currentData.name !== gn.name) return true; |
457 | 461 | if (currentData.color !== gn.color) return true; |
| 462 | + if (!samePortNames(currentData.inputs, gn.inputs) || !samePortNames(currentData.outputs, gn.outputs)) return true; |
458 | 463 | if (!shallowEqualRecord(currentData.params, gn.params)) return true; |
459 | 464 | if (!shallowEqualArray(currentData.pinnedParams, gn.pinnedParams)) return true; |
460 | 465 | return false; |
|
0 commit comments