5 ms·
It's silly to do a round trip to the server just to change some local UI state, right?
by dsego 7y ago
It's silly to do a round trip to the server just to change some local UI state, right?
- manigandham 7y agoNot really, this kind of thinking is exactly what led to the client-side JS framework mess. Round trips are just fine. Browsers are smart, servers are fast, and HTML compresses well. The site you're reading right now (HN) requires a reload. Stackoverflow requires a reload. Neither are slow to use. If your page is really that complicated, then I suggest Vue or Preact which are efficient and designed to progressively enhance pages instead of rebuilding everything in JS.
- Roboprog 7y agoCompression over HTTPS can be problematic, as it makes the key easier to crack. I would like to trade out AngularJS for Vue someday, though.
- Nyandalized 7y agoConnectivity is not always available, and errors retrieving it may mean you have to re-enter everything. Being able to "navigate" the site without the dinosaur is a tremendous boon for end users. You wouldn't be able to send anything without a connection, but you could buffer it for an opportune moment. Sites like HN and Stackoverflow have a vastly different audience than most bread-and-butter sites, and tackle different kind of issues.
- manigandham 7y agoMost bread-and-butter sites are just fine as server-side rendered page. Large client-side frameworks reimplementing the browser and server functionality should be rare, when the situation actually calls for it. If you really need a offline site then a simple service worker is all you need to cache the pages, not a big JS app.
- Nyandalized 7y ago"Big JS app"'s aren't that big if done correctly. The entirety of Angular8 fits into ~170KB, less than some thumbnails. You can write bad apps in any language and environment, similarly a site/app is not bad just because it's done in Y.
- cutler 7y agoDon't underestimate pjax/turbolinks as a first approach. This way you get to render on the server without refreshing the whole page. For most business websites this is more than enough to keep rendering snappy.
- asark 7y agoIn theory, yes. In practice, by the time you get your whole web-app game on, the full round trip is often at least as fast, and frequently faster.
- winrid 7y agoDepends on the app. In some cases it results in a much simpler and easier to maintain environment (ie, Larvel or Symphony will do this better than Angular...)