How We Replaced React with Phoenix
By: Thought Bot
How We Replaced React with Phoenix
From the Thought Bot article:
We also added Turbolinks to the app which makes page transitions nearly seamless and let us keep that single-page app feel.
Older tweets on the topic:
Would be interesting to see in a Phoenix app just to compare and out of curiosity. I actually quite liked Turbolinks (in Rails anyway).
Yea, I always thought it was a very solid concept for more straightforward sites too. The bulk of your page load time is assets and turbolinks prevents all of those reloading on every page. Even if they’re browser cached, the browser still has to make the HEAD calls to verify last modified and etag for every asset. After reading that article yesterday I tried loading it up on my site but kept get blank pages on every click.
Turbolinks is one of those things that I’d love to be able to get working if I wanted it, but would definitely stay away from building into Phoenix under any circumstances.
This is not true. Browsers do not make HEAD requests to check if a cached resource is fresh. They also won’t make a request at all if the resource is cached and the response had cache headers which indicates the resource is long-lived. All proper asset systems makes sure to set response header that ensures the client caches the resource for a long time.
A post was split to a new topic: Everything being re-requested on production server
I posted this in another thread but maybe something like progressive rendering would be a better fit for Phoenix…
I spend too much time in Firefox Developer Edition.
The reprocessing of all CSS and JS on each page load would still apply without Turbolinks though, even if it does have a far future expire.
Seems would be good match for Phoenix for MVPs. I have personally never used it so would appreciate information from people who have experience with Turbolinks in production.
Seems like it would actually be fairly easy to do in Phoenix, although I wonder if it is still useful with HTTP/2.
It’s for the most part orthogonal to HTTP/2. It’s more that if there are time and/or resource constraints for delivering full size SPA+Server side rendering+API+Android+iOS solution this seems to provide a “good enough” option. The fact that with http/2 we will get faster page transitions if used with turbolinks is just an added bonus.
Hmm, an idea for even faster, instead of another request and then swapping the body, could request it over an open websocket. Would be easy to package up into a library.
See thread in the Phoenix category: Turbolinks with Phoenix
I have never tried Turbolinks before, but from what I’ve read: You don’t need it in Phoenix.
@andre1sk I’ve merged your thread with the existing one
With regards to Turbolinks, I actually quite like it (with Rails anyway) - it helps give the site an app feel. You can see it in action on a Rails site here (only on info, photos, and want more pages - the forum is not Rails) and some cat pages like here.
I’ve been toying around with a turbolinks/react apps lately. So far it seems quite solid. Turbolinks makes all the crud stuff seem snappy and react allows for the higher fidelity UI to be well designed and sprinkled throughout the app. It has pain points, but far fewer pain points then going full SPA.
If enough folks are interested in this I would be more than happy to extract a demo app out of my project.
This sounds pretty cool. Currently I’m playing with vue.js because it plays well with the rendered DOM.
But I’m very interested in a demo app, or more information
Would be really cool
[quote=“nerdyworm, post:14, topic:1091”]
It has pain points
[/quote] What would you consider to be the biggest pain points?
I would also like to see a demo how you integrated turbolinks and react into phoenix without having a SPA.
Is it live anywhere @nerdyworm? I’d love to see it on a production site
I added a turbolinks branch to a demo forum app that I made just to see what it would be like. You can view it here if you want
How does it perform with phoenix? Done any timings with Chrome’s network graph or so? Any integration issues? Any CSRF issues? Etc…?