Browse Source

fix(44): skip dimmed source nodes in getConnectedInputs

When paths reconverge downstream of a Switch, dimmed nodes (from disabled
outputs) still held stale data from previous runs. getConnectedInputs now
accepts dimmedNodeIds and skips any source node in the dimmed set, preventing
disabled Switch paths from leaking data into downstream nodes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 5 months ago
parent
commit
be29ebb291
  1. 10
      src/store/utils/connectedInputs.ts
  2. 4
      src/store/workflowStore.ts

10
src/store/utils/connectedInputs.ts

@ -125,7 +125,8 @@ export function getConnectedInputsPure(
nodeId: string,
nodes: WorkflowNode[],
edges: WorkflowEdge[],
visited?: Set<string>
visited?: Set<string>,
dimmedNodeIds?: Set<string>
): ConnectedInputs {
const _visited = visited || new Set<string>();
if (_visited.has(nodeId)) return { images: [], videos: [], audio: [], model3d: null, text: null, dynamicInputs: {}, easeCurve: null };
@ -169,9 +170,12 @@ export function getConnectedInputsPure(
const sourceNode = nodes.find((n) => n.id === edge.source);
if (!sourceNode) return;
// Skip dimmed source nodes — their data should not flow downstream
if (dimmedNodeIds && dimmedNodeIds.has(sourceNode.id)) return;
// Router passthrough — traverse upstream to find actual data source
if (sourceNode.type === "router") {
const routerInputs = getConnectedInputsPure(sourceNode.id, nodes, edges, _visited);
const routerInputs = getConnectedInputsPure(sourceNode.id, nodes, edges, _visited, dimmedNodeIds);
// Determine which type this edge carries based on the source handle
const edgeType = edge.sourceHandle; // Will be "image", "text", "video", "audio", "3d", or "easeCurve"
@ -204,7 +208,7 @@ export function getConnectedInputsPure(
}
// Enabled switch: recursively get upstream data (same pattern as router)
const switchInputs = getConnectedInputsPure(sourceNode.id, nodes, edges, _visited);
const switchInputs = getConnectedInputsPure(sourceNode.id, nodes, edges, _visited, dimmedNodeIds);
const edgeType = switchData.inputType;
if (edgeType === "image") {

4
src/store/workflowStore.ts

@ -848,8 +848,8 @@ const workflowStoreImpl: StateCreator<WorkflowStore> = (set, get) => ({
},
getConnectedInputs: (nodeId: string) => {
const { edges, nodes } = get();
return getConnectedInputsPure(nodeId, nodes, edges);
const { edges, nodes, dimmedNodeIds } = get();
return getConnectedInputsPure(nodeId, nodes, edges, undefined, dimmedNodeIds);
},
validateWorkflow: () => {

Loading…
Cancel
Save