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

chore: default initial selection in dropdown #9537

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deboer-tim
Copy link
Contributor

What does this PR do?

The select control automatically selects the first value if none is provided. Dropdown wasn't doing that so I added the appropriate line.

Screenshot / video of UI

N/A

What issues does this PR fix or reference?

Part of #6199. First part of #9510.

How to test this PR?

PR checks.

  • Tests are covering the bug fix or the new feature

The select control automatically selects the first value if none is provided.
Dropdown wasn't doing that so I added the appropriate line.

Part of containers#6199.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
@deboer-tim deboer-tim requested review from benoitf and a team as code owners October 22, 2024 15:37
@deboer-tim deboer-tim requested review from jeffmaury, cdrage and feloy and removed request for a team October 22, 2024 15:37
Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +44 to +46
if (!value && options?.length > 0) {
value = options[0].value;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

wondering if it's in onMount or in effect

if you update the options it should refresh the initial value I suppose ?

Copy link
Collaborator

@benoitf benoitf Oct 22, 2024

Choose a reason for hiding this comment

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

it seems that if one option is removed, it should check also if the value is still valid

so wondering if we don't need an 'initialValue' and a flag to check if the user has modified the value to either change it back to the initialValue when options are changing and if the user has not pickup anything

Copy link
Collaborator

Choose a reason for hiding this comment

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

(it looks like it's not reactive)

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.

3 participants