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: have inputs construct connections #7116

Merged
merged 3 commits into from
May 24, 2023

Conversation

BeksOmega
Copy link
Collaborator

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Fixes #2062

Proposed Changes

Makes it so that inputs must + can easily construct their own connections (for inputs that have connections).

Behavior Before Change

Inputs were passed their connections, except for custom inputs which weren't. It was difficult for custom inputs to construct their own connections, because they had to deal with rendered vs headless.

Behavior After Change

All inputs must construct their own connections. They can easily do this using the protected makeConnection method.

Reason for Changes

This makes built-in inputs and custom inputs more consistent. It also makes custom inputs with connections easier to implement.

Test Coverage

N/A

Documentation

N/A

Additional Information

N/A

@BeksOmega BeksOmega requested a review from rachel-fenichel May 24, 2023 16:57
@BeksOmega BeksOmega requested a review from a team as a code owner May 24, 2023 16:57
@github-actions github-actions bot added the PR: fix Fixes a bug label May 24, 2023
Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed since Rachel is ooo

core/block.ts Outdated Show resolved Hide resolved
@@ -298,6 +293,10 @@ export class Input {
this.connection.dispose();
}
}

protected makeConnection(type: number): Connection {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why isn't the type of type ConnectionType?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upon rereading this sentence: @_@

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

On the block version of this method we used to pass inputTypes to it sometimes, which isn't compatible with ConnectionType, so we had to use number instead. But since the code has been reorganized, that is no longer an issue =) Everything has been switched to use ConnectionType!

core/inputs/input.ts Outdated Show resolved Hide resolved
@BeksOmega BeksOmega requested review from maribethb and removed request for rachel-fenichel May 24, 2023 19:50
@BeksOmega BeksOmega merged commit 473a5ab into google:develop May 24, 2023
@BeksOmega BeksOmega deleted the fix/inputs-construct-connections branch May 14, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for custom inputs
3 participants