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

Server side rendering discarded #8

Open
santhoshmahalingam opened this issue Oct 19, 2016 · 2 comments
Open

Server side rendering discarded #8

santhoshmahalingam opened this issue Oct 19, 2016 · 2 comments

Comments

@santhoshmahalingam
Copy link

Hi,

I am getting an issue as Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.

Can you help me on this.

Thanks in advance.

Santhosh

@raydecastro
Copy link
Member

@santhoshmahalingam are you getting that error from cloning the repo and running it? or from following the instructions and building it from scratch?

I think I've experienced a similar issue once before, and it was related to the following (as mentioned in the readme):

GOTCHA:

SSR caching of components only works in PRODUCTION mode, since the props(which are read only) are mutated for caching purposes and mutating of props is not allowed in development mode by react.

Make sure the electrode-react-ssr-caching module is imported first followed by the imports of react and react-dom module. SSR caching will not work if the ordering is changed since caching module has to have a chance to patch react's code first. Also if you are importing electrode-react-ssr-caching, react and react-dom in the same file , make sure you are using all require or all import. Found that SSR caching was NOT working if, electrode-react-ssr-caching is required first and then react and react-dom is imported.

@santhoshmahalingam
Copy link
Author

santhoshmahalingam commented Oct 25, 2016

@raydecastro , Thanks for your response. I am new to react and electrode. I made two mistakes that i was looking for SSR caching in dev mode as well SSR caching module imported after react. It works fine for me now, Thanks.

But i have an another problem that while trying load DOM from api calls following hapi-universal-redux I didnt get the DOM for SEO. Because the page loads before i receive api response in my page.

Can you help me on this.

Thanks,

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