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 (SSR) #11

Open
arunoda opened this issue Jan 12, 2016 · 20 comments
Open

Server Side Rendering (SSR) #11

arunoda opened this issue Jan 12, 2016 · 20 comments

Comments

@arunoda
Copy link
Collaborator

arunoda commented Jan 12, 2016

Currently, we don't have support for SSR.
Also our directory layout does not support it.
We need to work on it.

This is because of current state of Meteor 1.3
I didn't wanted to put code into imports directory and but we can't put them into a common place because, there might be some modules (code) available only for client.

Then even the user don't wanna use SSR, he'll has to face issues of SSR.

May be we need to put the app into the imports directory anyway

@natecox
Copy link

natecox commented Jan 12, 2016

@arunoda I think I'm behind the times here. Can you give me a link to the references you're using for Meteor 1.3's structure?

@arunoda
Copy link
Collaborator Author

arunoda commented Jan 12, 2016

You mean this one? https://github.com/mantrajs/mantra-sample-blog-app

@natecox
Copy link

natecox commented Jan 12, 2016

@arunoda no, sorry, in reference to Meteor 1.3 itself. From a few comments made it seems like Meteor 1.3 is making changes to the directory structure, but I haven't been able to find a good explanation of what those are yet.

@arunoda
Copy link
Collaborator Author

arunoda commented Jan 12, 2016

Check this: https://atmospherejs.com/meteor/modules

@natecox
Copy link

natecox commented Jan 12, 2016

ah! Yes, that'll do. I'll explore that and then come back to this with a more informed opinion.

@achtan
Copy link
Contributor

achtan commented Jan 28, 2016

what's new with the SSR, now as we put our modules into /imports does this solve our problem with SSR?

or what is the issue with SRR?

@arunoda
Copy link
Collaborator Author

arunoda commented Jan 28, 2016

Actually, now we've come back to the client directory.
See: mantrajs/mantra-sample-blog-app@1a2ecbc

There are some ways. We'll take care of this after the module release coming on Monday.

@arunoda
Copy link
Collaborator Author

arunoda commented Mar 1, 2016

Note:

Here with SSR, we need to create a context from the scratch for every request. We need to find a way to deal with that.

Otherwise, this will lead to race conditions and other issues.

@achtan
Copy link
Contributor

achtan commented Mar 9, 2016

@arunoda any update on this one?

@tonyxiao
Copy link
Contributor

Was playing around with this. Naively loading mantra modules on the server doesn't work due to things like method_stubs and use of Meteor.[user|subscribe] methods inside containers and actions. To support SSR will some explicit effort.

@natecox
Copy link

natecox commented Mar 10, 2016

I'm coming to the conclusion that SSR is a pain in the ass in general. I just had an issue on a large project where SSR would fail because the components being rendered used libraries like GoogleMaps from atmosphere, with the code exported to use client only... meaning it just wasn't there on the server side render and everything failed horribly. Same type of issue with Redux.

My solution was to write a router specifically for the server and just serve simple pages. Works fine for opengraph, not nearly as good for actual SEO.

@SachaG
Copy link

SachaG commented Mar 10, 2016

@natecox I feel like it's fine to use the No-SSR packages for cases like this? Personally so far I've found SSR to work pretty well (although it's in a non-Mantra app).

@natecox
Copy link

natecox commented Mar 10, 2016

@SachaG That's actually pretty cool, I hadn't seen that one yet. Not sure it solves the issues I was having with Redux, because that's so tightly coupled with global state, but that's probably more to do with the fact that I added Redux late into the project and it's probably not set up optimally.

@tonyxiao
Copy link
Contributor

Oh No-SSR that's a really clever package. Yea right now I'm using https://github.com/thereactivestack/meteor-react-router-ssr as an example to inject OpenGraph meta tags into pages served by meteor. Quite a hack but does get the most important use case covered.

@natecox
Copy link

natecox commented Mar 10, 2016

@tonyxiao I'm probably going to have to do the same thing on my project now. Any advice on getting it implemented properly and converting from FlowRouter?

@tonyxiao
Copy link
Contributor

@natecox Here I just created it gist - https://gist.github.com/tonyxiao/92e3d994eec0d762a17e. It's a real hack but if @eXon uses it it must be ok.

@tonyxiao
Copy link
Contributor

I ended up converting from FlowRouter to ReactRouter due to the tighter integration with react ecosystem. Was a bit painful but took one day in total so not too bad. Biggest gotcha was that you can't just pass any props into component rendered by ReactRouter. That required architecting components a bit differently. (Mapping more closely to pages if you want to parse the params). Anyways that's probably off topic so I'll stop here.

@achtan
Copy link
Contributor

achtan commented Mar 11, 2016

I think ill just use spiderable for now

@rvetere
Copy link

rvetere commented Jun 8, 2016

Any updates on the general SSR topic for mantra @arunoda? ;)

@bompi88
Copy link

bompi88 commented Aug 23, 2016

+1 This would be a really nice feature

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

7 participants