-
Notifications
You must be signed in to change notification settings - Fork 14
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
Server rendering with same data is generating different checksums and ids #3
Comments
I think I figured out the issue. For server side rendering it will use random root id's and since the checksum uses that it won't match. However there is some other algorithm on the client that can determine if things are different (other than simply comparing checksum). If things aren't matching one should see a warning in the console log "React attempted to reuse markup in a container but the checksum was invalid." so if we aren't seeing that then React is properly using the content. |
Thanks @jesstelford for pointing out how to see the render in chrome debugger, that helps. |
You're welcome :) I used a little trick to isolate the browser-side changes: I wrapped the Don't forget to check out Part 2: Unit testing React Components with Mocha + jsdom |
Thanks, yes I have already went through part 2 and 3 :-) I liked your idea of using jsdom to test with Mocha rather than trying to fire up something like Phantom. The article helped me get all that working, though I did have to make a few changes to use with the latest jsdom. I'll open a PR with the changes I needed to make. I appreciated you sharing all of this since it made it easier to get going. |
Jess,
If you modify your server/index.js so that it is actually rendering with the latest data on every request (rather than always using the same copy of html),
then even though the data is still the same, the checksum rendered is now different on every render???
In fact, I found that simplifying the render down to just
generates a different checksum and id each time it is called?
Something doesn't add up here.
Thoughts?
Thanks,
Jeff
The text was updated successfully, but these errors were encountered: