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

renderToString incorrectly supports select's defaultValue #4333

Closed
nkt opened this issue Jul 9, 2015 · 2 comments
Closed

renderToString incorrectly supports select's defaultValue #4333

nkt opened this issue Jul 9, 2015 · 2 comments

Comments

@nkt
Copy link

nkt commented Jul 9, 2015

Here is code for reproducing:

var Test = React.createClass({
  render: function() {
    return (
      <select defaultValue={this.props.current}>
        {this.props.items.map((i) => (
          <option value={i} key={i}>{i}</option>
        ))}
      </select>
    );
  }
});

var container = document.getElementById('container');
var code = document.getElementById('code');
var test = <Test items={[1, 2, 3]} current={2} />;
var prerender = React.renderToString(test);
code.innerText = prerender.replace(/></g, '>\n<');

container.innerHTML = prerender;
setTimeout(() => {
  React.render(test, container)
}, 1000);

So I'm rendering select on the server and got small lag on the client.

@jimfb
Copy link
Contributor

jimfb commented Jul 9, 2015

Well, that's annoying. https://jsfiddle.net/pgtf6aym/

@jimfb jimfb added the Type: Bug label Jul 9, 2015
@zpao
Copy link
Member

zpao commented Jul 9, 2015

Fixed in 0.14 by #3595.

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

3 participants