Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/lib/components/FlowCanvas.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,6 +151,10 @@
// Track port counts to detect changes - used to force node re-renders
let portCounts = new Map<string, { inputs: number; outputs: number }>();

/** 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([]);

Expand Down Expand Up @@ -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;
Expand Down