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 option value is not being set when using variables #291

Closed
cayasso opened this issue Feb 20, 2017 · 2 comments
Closed

Select option value is not being set when using variables #291

cayasso opened this issue Feb 20, 2017 · 2 comments

Comments

@cayasso
Copy link
Contributor

cayasso commented Feb 20, 2017

You can see the issue here, that instead of alerting with the property value tierrasdelcafe it is falling back alerting with Tierras del cafe which is the correct behavior when value doesn't exist.

https://svelte.technology/repl/?version=1.6.8&gist=c0a81f341a7652bbc68c129d0b0105d2

Checking the output I noticed that a line like this is missing option1.value = option1.__value in the renderMainFragment method.

I did some more investigation and found the problem at this line

Changing that line to this, resolves the issue.

if ( isBoundOptionValue ) {
    local.init.addLine( `${local.name}.value = ${local.name}.__value` );

    if (dynamic) {
          local.update.addLine( `${local.name}.value = ${local.name}.__value` );
    }
}

I have the code ready with a passing test for a pull request but wanted to consult before submitting it.

Thanks for this awesome project!

@Rich-Harris
Copy link
Member

@cayasso good catch! Your fix looks correct — would be very grateful for that PR. Thanks!

cayasso added a commit to cayasso/svelte that referenced this issue Feb 24, 2017
cayasso added a commit to cayasso/svelte that referenced this issue Feb 24, 2017
@cayasso
Copy link
Contributor Author

cayasso commented Feb 24, 2017

^^^^
you are welcome!

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

No branches or pull requests

2 participants