5 ms·
Actually the first thing I do nowadays when I start a new project using rails is turn off turbolinks. Rails has so many "magic" hidden underneath and Turbolinks
by cocktailpeanuts 9y ago
Actually the first thing I do nowadays when I start a new project using rails is turn off turbolinks. Rails has so many "magic" hidden underneath and Turbolinks is the epitome of this problem. I have no idea how it works, but all I know is it breaks my apps too often if I ever make use of a lot of JavaScript code.
Nowadays I do:
1. Pure old school websites with no SPA approach (Surprisingly, most web apps work just fine this way. You're just being tricked into building SPA when you don't need one)
2. Use rails as API backend and use frontend JS framework (I do this when I know I will need to make this work both on the web and mobile. Since I just need to write the API once and use it cross platform, it's much more efficient this way IF I'm doing something like this)
Turbolinks actually doesn't fit into any of this workflow and just complicates things IMO.
- deleted 9y ago[deleted]
- toasterlovin 9y agoAs a counterpoint, Turbolinks has been an unmitigated success for a huge app that I work on. 80% of the performance and responsiveness of an SPA with about 5% of the work. Granted, the app is very vanilla-Rails. I can see Turbolinks getting in the way if you have a bunch of other "complicated" Javascript, but if your app is mostly standard Rails views plus some jQuery, Turbolinks is an amazing hack.
- cocktailpeanuts 9y agoYes, but my point was that if I want my app to be "vanilla rails with jQuery" (which actually is all you need for most web apps), I actually WANT it to behave like a "website", meaning I DON'T want it to behave like a single page app because it's confusing both for users and the developer (myself), which is where turbolinks comes in.
- toasterlovin 9y agoIMO, it doesn't behave like a single page app. It just performs like one (aka, it's fast as heck).
- owens99 9y agoTurbolinks isn't that complicated. You should spend a day or two to learn it. Definitely useful in for #1. Depends on what you want to do for #2.
- cocktailpeanuts 9y agoI guess I should have clarified. I just don't like how it does things I don't want it to do, because when I'm using rails + simple javascript, there's a reason why I'm doing that instead of API + frontend JS framework SPA approach--I WANT it to work like a website, with full page refresh and all. And I would like to say, for most use cases this is actually much better user experience than trying to make it work as SPA because users want to see "clear cut answers" to their actions. This used to be simple when web pages just refreshed, but with single page apps, there are so many points of failure that you have to build all kinds of middleware just to make sure this type of client/server inconsistency doesn't happen. And I think this is overkill. Most people have been using regular websites just fine, and even when I've built tons of SPA for living, I myself still prefer regular web pages, you know, like hacker news. It's simple and it works. No state inconsistency, no memory hog.
- owens99 9y agoInteresting points. Hasn't been my experience Turbolinks does anything I don't want since Rails5.