Open mitar opened 8 years ago
Okay. If so, I think this is super cool. This is how to add the support for SSR.
Make sure BlazeComponents are rendered inside a FlowRouter action. In the client, do it normally. In the server, generate the HTML and send it to FlowRouter like this:
See: https://github.com/kadirahq/react-mounter/blob/master/lib/server.js#L26
What about wrapping subscribe calls inside Blaze Components? Will this be done automatically?
Yes. They are automatic. But they need to happen in the same eventloop cycle where FlowRouter .action() is called.
Using it inside a Tracker.autorun
is fine.
+1
I would like to contribute. Is anyone actively doing this? Seems like the guide dropped iron router
Blaze is not available on the server side, but Blaze Components are. I have not done much testing with SSR, but I am opening ticket here if anyone is interested to try to implement it.
(Just to be clear, if you use Blaze Components, you can also use pure Blaze, so using Blaze Components instead of Blaze gives you also normal Blaze support on the server side. So this can work even for simple Blaze templates.)
See related ticket in Blaze Components repository: https://github.com/peerlibrary/meteor-blaze-components/issues/110