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

Issues with server side rendering. #10

Closed
ghost opened this issue Sep 13, 2017 · 10 comments
Closed

Issues with server side rendering. #10

ghost opened this issue Sep 13, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2017

Hey there,
We're trying this with this starter kit https://github.com/kriasoft/react-starter-kit. The issue that we're having is that we get an empty div when the client renders. If we disable Javascript, we get all the <XBlock> items. With Javascript enabled we see the first load on the server and then all content disappears.
We wrapped the content in a div (display block) as you suggest in #2

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) <div class="xmasonry" style="position:re
 (server) <div class="xmasonry xmasonry-static" st

Any ideas what could be the issue?

Thanks!

@nikitaeverywhere
Copy link
Owner

Interesting. Thank you Alejandro again for pointing on XMasonry issues.

I see the problem. I think it's a major server-side rendering algorithm cons. When designing it, I was expecting that server-side rendered markup will never go directly to browser but to search bots for example.

Could you please create a demonstation code/repo for this problem? It would dramatically save my time and I suppose you already have a setup.

Thank you!

P.S. Expect me to get back to this in ~17 hours, hopefully that's okay to you!

@alejandronanez
Copy link

Hey @zitros thanks a lot for your collaboration!
I have the code on a private repo but let me see if I can repro it locally with a new project.

Thanks again!

@alejandronanez
Copy link

Hey @ZitRos I couldn't replicate this locally. Here's the repo (the warning is still there though)
https://github.com/alejandronanez/ssr-masonry

Any clue you have about how we can make this work is really appreciated!

Thanks!

@nikitaeverywhere
Copy link
Owner

nikitaeverywhere commented Sep 14, 2017

Aha, it's just a warning. The reason behind this is that XMasonry adds some additional stylings while rendering on the server.

I think we can simply remove those styles as they can be defined another way, by the user. But before doing this, please, check whether this helps. Thank you!

@ghost
Copy link
Author

ghost commented Sep 14, 2017

Sweet! We really like this module, thanks a lot for building it.

We can close this issue then.

@ghost ghost closed this as completed Sep 14, 2017
@nikitaeverywhere
Copy link
Owner

Thank you for the feedback!

Did the SO answers I linked eliminated the warning? I wasn't diving deep to React's server side rendering so it may be a good topic to discuss. Anyway, tell me if it's on XMasonry side.

Cheers!

@ghost
Copy link
Author

ghost commented Sep 15, 2017

We haven't tried that yet! Will let you know once we try it though.

@nikitaeverywhere
Copy link
Owner

nikitaeverywhere commented Sep 15, 2017 via email

@paustria
Copy link

paustria commented Dec 5, 2018

I'm having this issue. How do we fix this?

@nikitaeverywhere
Copy link
Owner

nikitaeverywhere commented Dec 6, 2018

@paustria, could you please post a simple reproduction/demo of the issue? It would be much appreciated.

This issue was closed.
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

3 participants