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

<Select> does not show the correct initial option if <options> are loaded asynchronously #5051

Closed
wilcoschoneveld opened this issue Jun 22, 2020 · 4 comments · Fixed by #5054

Comments

@wilcoschoneveld
Copy link

Describe the bug
I have a use case where <select> options are loaded from the backend, but the selected value is loaded earlier. It seems that when the <options> are rendered, the first option is displayed even if another is selected.

Logs
N/A

To Reproduce
https://svelte.dev/repl/9c7fdb3a0a9643839a21287c818a90c7?version=3.23.2

Expected behavior
When loading the repl, the selected value should be BAR according to value = 2

Stacktraces
N/A

Information about your Svelte project:
Svelte version: 3.23.2

Severity
Blocking

@wilcoschoneveld wilcoschoneveld changed the title <Select> does not show the correct option if <options> are loaded asynchronously <Select> does not show the correct initial option if <options> are loaded asynchronously Jun 22, 2020
@Conduitry
Copy link
Member

This sounds like a duplicate of #1764, which should have been fixed in 3.23.0 with #4885, but perhaps not.

@skippednote
Copy link
Contributor

skippednote commented Jun 23, 2020

@wilcoschoneveld It should work if you bind the value on select. https://svelte.dev/repl/547a106be6da4113a2a36db952e07872?version=3.23.2

@Conduitry binding was missing in the shared repl.

@wilcoschoneveld
Copy link
Author

Thanks for the fix!

@Conduitry
Copy link
Member

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 a pull request may close this issue.

3 participants