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

React 15 breaks server rendering check-sum #6487

Closed
buzinas opened this issue Apr 11, 2016 · 2 comments
Closed

React 15 breaks server rendering check-sum #6487

buzinas opened this issue Apr 11, 2016 · 2 comments

Comments

@buzinas
Copy link

buzinas commented Apr 11, 2016

I'm developing an universal app with React, and after updating to v15.0.1, I started getting this error:

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) ut class="md-input" name="txtCadmus" pat
(server) ut class="md-input" pattern="[0-9]*" nam

It seems to be some bug on V8 Object.assign reordering or something like that, but I'm not completely sure.

Tried to change a bunch of stuff (e.g: force both server and client to use a polyfill, or using Babel transform object-assign plugin), but nothing solved the problem.

Then, I uninstalled React 15.0.1 and installed 0.14.8 again, and the problem was gone.

Btw, it's pretty simple to simulate the issue:

Code

ReactDOM.render(
  <input name="my-input" className="my-class" type="number" pattern="[0-9]*" />, document.querySelector('#main')
);

console.log(document.querySelector('#main').innerHTML)

console.log(ReactDOMServer.renderToString(
  <input name="my-input" className="my-class" type="number" pattern="[0-9]*" />
));

React 15 not working

15 0 1

React 0.14.8 working as expected

0 14 8

@zdila
Copy link

zdila commented Apr 11, 2016

I have the same issue. Some of the compared server/client elements have same attributes but in different order. React then treats them as different. Strange is that in my case ordering changes not before first page reload. Very first rendering is OK.

@gaearon
Copy link
Collaborator

gaearon commented Apr 11, 2016

Yes, please track this in #6451.

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