Skip to content

Extract model output dropdown to its own component#2839

Merged
charisk merged 1 commit intomainfrom
charisk/model-output-dropdown
Sep 20, 2023
Merged

Extract model output dropdown to its own component#2839
charisk merged 1 commit intomainfrom
charisk/model-output-dropdown

Conversation

@charisk
Copy link
Copy Markdown
Contributor

@charisk charisk commented Sep 20, 2023

This will allow us to reuse code for the new method modeling panel.

See similar PR: #2833

Checklist

N/A:

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Base automatically changed from charisk/modeled-method-kind to main September 20, 2023 12:36
@charisk charisk force-pushed the charisk/model-output-dropdown branch from 34275be to 4fd8150 Compare September 20, 2023 12:55
@charisk charisk marked this pull request as ready for review September 20, 2023 12:57
@charisk charisk requested a review from a team as a code owner September 20, 2023 12:57
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

A couple of suggestions to make the code simpler, but also LGTM as it is.

[argumentsList],
);

const enabled = useMemo(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this is a primitive type and the value is not hard to compute, I don't believe we gain anything by using useMemo. If you'd prefer to not make any changes in this PR I'm happy to open it as a followup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm following the same pattern as in #2837 so I'd rather keep it consistent. Happy to stick to useMemo or drop it, but would rather do the same across the board.

modeledMethod,
onChange,
}: Props): JSX.Element => {
const argumentsList = useMemo(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

argumentList is only used to compute options, so we could merge these together and call geArgumentList on line 27 and it wouldn't change any behaviour. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah good point. I could do the same in ModelInputDropdown.

If we keep things as is we would be consistent with ModelInputDropdown and ModelTypeDropdown though.

I don't have strong opinions.

@charisk
Copy link
Copy Markdown
Contributor Author

charisk commented Sep 20, 2023

I'm going to go ahead and merge this as I have another PR lined up but will apply any feedback in a separate PR.

@charisk charisk merged commit 4e09640 into main Sep 20, 2023
@charisk charisk deleted the charisk/model-output-dropdown branch September 20, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants