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

Dropdown: incorrect selection when dynamically changing options #2410

Closed
searene opened this issue Jan 6, 2018 · 3 comments
Closed

Dropdown: incorrect selection when dynamically changing options #2410

searene opened this issue Jan 6, 2018 · 3 comments

Comments

@searene
Copy link
Contributor

searene commented Jan 6, 2018

I want to change a DropdownItem's text dynamically after selecting it. However I ran into an issue here.

Steps

  1. Open codesandbox
  2. Click on the Dropdown list
  3. Select beforeSelecting
  4. Click on the Dropdown list again
  5. You can see that the text shown in the Dropdown list is still defaultOption, rather than afterSelecting

Expected Result

The text shown in step 5 should be afterSelecting.

Actual Result

The text shown in step5 is defaultOption.

Version

0.75.1

Testcase

https://codesandbox.io/s/8xmx8mymk9

@layershifter
Copy link
Member

Dropdown relies on value prop, keep it same, see this pen. However, I don't see the described issue in your example, can you provide more details?

@searene
Copy link
Contributor Author

searene commented Jan 7, 2018

Hi layershifter,

Here are more details.

Suppose the current selected item is defaultOption, what we see would be like this.

correct

That's correct, but if I click on beforeSelecting, what we see would be like this.

incorrect

As you can see, afterSelecting should be in the title and should be in the grey background, but it's not, that's inconsistent, and that's the issue here.

@layershifter layershifter changed the title Issues occurred when dynamically changing the DropdownItem's text Dropdown: incorrect selection when dynamically changing options Jan 7, 2018
@layershifter
Copy link
Member

Thanks, now I see the problem 👍 Looks like similar to #2336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants