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

Use Sequence lengths when determining validity for connections #2976

Closed
wants to merge 1 commit into from
Closed
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
31 changes: 31 additions & 0 deletions src/renderer/helpers/canConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,37 @@ export const canConnect = (
);
}

const outputSequenceType = sourceFn.outputSequence.get(sourceOutputId);
if (outputSequenceType !== undefined) {
const schema = targetSchema;
const input = schema.inputs.find((i) => i.id === targetInputId)!;

const inputSequenceType = targetFn.inputSequence.get(targetInputId);
if (inputSequenceType) {
const inputSequenceTypeNotNull = withoutNull(inputSequenceType);

const error = simpleError(outputSequenceType, inputSequenceTypeNotNull);
if (error) {
return invalid(
`Input ${input.label} requires ${error.definition} but would be connected with ${error.assigned}.`
);
}

const traceTree = generateAssignmentErrorTrace(
outputSequenceType,
inputSequenceTypeNotNull
);
if (traceTree) {
const trace = printErrorTrace(traceTree);
return invalid(
`Input ${
input.label
} cannot be connected with an incompatible value. ${trace.join(' ')}`
);
}
}
}

// Iterator lineage check
const sourceLineage = chainLineage.getOutputLineage(sourceHandle);
const lineageValid = checkAssignedLineage(
Expand Down
Loading