<story><title>Speeding Up Rendering Rails Pages with render_async</title><url>https://semaphoreci.com/blog/2017/06/08/speeding-up-rails-pages-with-render-async.html</url></story><parent_chain><item><author>matthewmacleod</author><text>That&amp;#x27;s actually a relatively nice, Rails-magic-style approach to solving this sort of thing. Of course, if you were building a more interactive application, you&amp;#x27;d already have a JS framework in place that would negate these benefits – but I&amp;#x27;m still convinced there&amp;#x27;s a nice middle-ground for server-rendered Rails apps that avoids the various problems of SPAs.&lt;p&gt;It would be nice if it worked without JavaScript though – an increasing pain-in-the-arse about the web generally. If only it were possible to have &amp;lt;iframe&amp;gt;s adjust to their content size, then we wouldn&amp;#x27;t need JavaScript at all!</text></item></parent_chain><comment><author>kawsper</author><text>I was the original author of this gem, so it is nice to see it here on HN, I have since passed it on the the caring hands of Semaphore since they wanted to maintain and improve it :-)&lt;p&gt;The software was built for a forum where the admin buttons was only for specific users, but the rest of the frontend was the same, so we used render_async to render some content for some users, and other content for admins, and the rest of the page could be cached statically.&lt;p&gt;We later changed it to use edge side includes with Varnish. An example of this is where you add the to your HTML:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;lt;esi:include src=&amp;quot;http:&amp;#x2F;&amp;#x2F;example.com&amp;#x2F;1.html&amp;quot; alt=&amp;quot;http:&amp;#x2F;&amp;#x2F;bak.example.com&amp;#x2F;2.html&amp;quot; onerror=&amp;quot;continue&amp;quot;&amp;#x2F;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
This will make Varnish fetch the URL(s), assemble the page and present it to the client, so your backend might see more requests, but the client only sees one.</text></comment>
<story><title>Speeding Up Rendering Rails Pages with render_async</title><url>https://semaphoreci.com/blog/2017/06/08/speeding-up-rails-pages-with-render-async.html</url></story><parent_chain><item><author>matthewmacleod</author><text>That&amp;#x27;s actually a relatively nice, Rails-magic-style approach to solving this sort of thing. Of course, if you were building a more interactive application, you&amp;#x27;d already have a JS framework in place that would negate these benefits – but I&amp;#x27;m still convinced there&amp;#x27;s a nice middle-ground for server-rendered Rails apps that avoids the various problems of SPAs.&lt;p&gt;It would be nice if it worked without JavaScript though – an increasing pain-in-the-arse about the web generally. If only it were possible to have &amp;lt;iframe&amp;gt;s adjust to their content size, then we wouldn&amp;#x27;t need JavaScript at all!</text></item></parent_chain><comment><author>realusername</author><text>I&amp;#x27;m also using react-rails on my case to make a bridge between rails and react and it has been very useful so far, you can even render components server-side to test them with rspec.</text></comment>