Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compound type propagation for selectOutput #4763

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Changes from 1 commit
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
23 changes: 22 additions & 1 deletion packages/client/hmi-client/src/services/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,29 @@ export class WorkflowWrapper {
const targetPort = targetNode.inputs.find((port) => port.id === edge.targetPortId);
if (!targetPort) return;
edge.sourcePortId = selected.id; // Sync edge source port to selected output

const selectedTypes = selected.type.split('|').map((d) => d.trim());
const allowedInputTypes = targetPort.type.split('|').map((d) => d.trim());
const intersectionTypes = _.intersection(selectedTypes, allowedInputTypes);

// Not supported if there are more than one match
if (intersectionTypes.length > 1) {
console.error(`Ambiguous matching types [${selectedTypes}] to [${allowedInputTypes}]`);
return;
}
if (intersectionTypes.length === 0) {
return;
}
if (selectedTypes.length > 1) {
mwdchang marked this conversation as resolved.
Show resolved Hide resolved
const concreteType = intersectionTypes[0];
if (selected.value) {
targetPort.value = [selected.value[0][concreteType]];
}
} else {
targetPort.value = selected.value; // mark
}

targetPort.label = selected.label;
targetPort.value = selected.value;
}

// Collect node cache
Expand Down
Loading