News for hackers. Stuff that matters.
Re:In Defense of the Modern Web by MrRadar on Friday May 15, 2020 @11:03AM (#23192978)
> When I tap on a link on Tom's JS-free website, the browser first waits to confirm that it was a tap and not a brush/swipe, then makes a request, and then we have to wait for the response. With a framework-authored site with client-side routing, we can start to do more interesting things. We can make informed guesses based on analytics about which things the user is likely to interact with and preload the logic and data for them. We can kick off requests as soon as the user first touches (or hovers) the link instead of waiting for confirmation of a tap — worst case scenario, we've loaded some stuff that will be useful later if they do tap on it.

How many sites actually do this? And how much additional bandwidth (and battery life for mobile devices) does doing this consume?

> We can provide better visual feedback that loading is taking place and a transition is about to occur. And we don't need to load the entire contents of the page — often, we can make do with a small bit of JSON because we already have the JavaScript for the page.

In my experience sites that do this are almost universally slower and less responsive than sites that just use normal links. Maybe that's just confirmation bias and I just don't notice it as much on sites that do it well, but a particularly egregious example of this is Reddit's current mobile site vs their old i.reddit.com mobile site (which I use exclusively (despite it missing a number of newer features and having a lot of minor bugs the newer site doesn't) because it's way way faster).

Re:In Defense of the Modern Web by AlexandrB on Friday May 15, 2020 @11:38AM (#23193420)
> In my experience sites that do this are almost universally slower and less responsive than sites that just use normal links.

Yup. A car analogy: "Instead of waiting for the driver to turn the steering wheel before causing the car to turn, we put the car on the back of a flatbed truck that tracks driver behaviour and tries to predict their intent. Then we can start turning the flatbed truck a little bit sooner to improve user experience."

Re:In Defense of the Modern Web by Isomorpheus on Friday May 15, 2020 @12:07PM (#23193779)
> Maybe that's just confirmation bias and I just don't notice it as much on sites that do it well

This seems to me to be the key phrase.

I sympathize with all the "JS has gone too far" people in this thread. I also hate bloated JS apps. But, "almost all SPAs are bloated trash" is a distinct claim from "SPAs are intrinsically trash".

In my experience it is possible to have lean, high-performance, accessible SPAs without too much developer difficulty. Svelte (created by the author of this article) is one framework in this space, although I think there are better approaches.

Re:In Defense of the Modern Web by rephrase on Friday May 15, 2020 @12:17PM (#23193888)
Do you know of good SPAs? Sites that feel snappy even though they're SPAs. Most sites I visit that are SPAs are consistently slow so I've learned to make the same association: SPA = bad.
Re:In Defense of the Modern Web by fleddr on Friday May 15, 2020 @02:50PM (#23195842)
I love this question, in another comment I call it the Fermi paradox of SPAs. Where are they?

The simple question as to where are all these inspiring SPAs that truly push the web to next levels...is completely unanswered.

We get docs sites, demos and blogs. Where when clicking on a link...wow!...it loads without a page refresh. Something possible using simple ajax some 15 years ago.

Re:In Defense of the Modern Web by evilduck on Friday May 15, 2020 @01:34PM (#23194880)
We've been experiencing sluggish pages since long before JS really became a thing too. PHP and a slow inline query to render results has been a possible problem for literally decades.

Do you investigate all the fast snappy sites you visit to confirm they aren't single page apps? What about the slow pages that aren't SPAs (most every news site)?

It seems like anyone who wants to dislike JS and/or SPAs can easily confirmation-bias their way into believing it.

Re:In Defense of the Modern Web by rephrase on Friday May 15, 2020 @01:56PM (#23195177)
That's why I asked for examples. I want to know what are the good examples. Someone mentioned the main react site. Seems like a good place to start.
Re:In Defense of the Modern Web by Isomorpheus on Friday May 15, 2020 @01:59PM (#23195214)
I understand what you mean. In fact, I think we should more frequently do the opposite: we should publicly shame slow websites (cough new Reddit).

Anyway, for fast SPAs, here is a useful comparison: the "RealWorld app" demo.

I would urge everyone to look at the Lighthouse audits for these three implementations:

React/Redux: https://react-redux.realworld.io/

Angular: https://angular.realworld.io/

Vue: https://vue-vuex-realworld.netlify.app/#/

Svelte/Sapper: https://realworld.svelte.dev/

Solid.js: https://ryansolid.github.io/solid-realworld/

This is just a demo, of course, but it is close enough to be representative. From just this simple demo we can already see significant differences: Svelte and Solid.js are much snappier. The author of the article, Rich, created Svelte.

Of course, this is just talking about performance, not yet getting accessibility, navigation, transitions, etc right.

Re:In Defense of the Modern Web by rephrase on Friday May 15, 2020 @03:22PM (#23196270)
Sure, but demos are a good place to start. Then we can figure out why exactly the non-demos are slow.
Re:In Defense of the Modern Web by kixiQu on Friday May 15, 2020 @01:26PM (#23194790)
It seems like this whole discussion would work better with examples where people are willing to say "This is done well, and it has these benefits from having been done in this way"
Re:In Defense of the Modern Web by rephrase on Friday May 15, 2020 @01:28PM (#23194810)
Yup.
Re:In Defense of the Modern Web by robertoandred on Friday May 15, 2020 @01:42PM (#23194984)
Re:In Defense of the Modern Web by rephrase on Friday May 15, 2020 @01:56PM (#23195182)
Thanks. I'll take a look.
Re:In Defense of the Modern Web by julianlam on Friday May 15, 2020 @10:06PM (#23199833)
Certain, check out https://community.nodebb.org, super quick SPA.