Live data from Hacker News

Why I hate your Single Page App

medium.freecodecamp.org

41–50 of 128 posts

Re: Why I hate your Single Page App

#41
> Maybe your single page app is different, but the ones that I know break most of my browser’s features, such as the back and forward buttons, page refresh, bookmarking, sending a link, or opening a link in a new window or tab.

My SPA is different - https://www.seasonalfoodguide.org.

Browser back button works like normal.

Each screen has its own discrete URL, so you can share links, refresh, bookmark or open in a new tab, just like any other website.

I think the criticism here is misguided. The problem is not with SPA as an architecture, it's with SPA devs not implementing features that end users are accustomed to on a website. They can all be added, it just takes effort.

The biggest valid criticism to SPAs IMHO is the initial site load. There are ways to mitigate (CDNs, progressive loading, compression, etc) but pound-for-pound SPAs probably have longer initial load times on average for the first page than a vanilla HTML site does.

Once it's loaded there's no faster way to traverse a website, IMHO.

Re: Why I hate your Single Page App

#42

Why I hate your classic HTML app: - Every click is a full page load, and you still didn't manage to get caching right, so it takes 2 seconds to load. - When I have multiple tabs open, your badges and notifications fall out of date, because you never poll for updates. - If I mis-enter information into a form, your error handling forgets all my information and I have to re-enter it. - You forgot to update the styles on…

You probably have never tried a classic HTML "app":

1. Every click is fetched and rendered faster than your javascript code has had a chance to execute, let alone fetch or render.

2. True, minor headache though compared to the vast improvements in usability.

3. Nope.

4. Nope, this is a bug - something javascript pages most certainly are not immune against.

Re: Why I hate your Single Page App

#43
He makes some good points. There are good reasons and uses of the tech in SPAs, for example, I show previews of documents made with forms by hiding the form and rendering the document, but on a blog app I made where I did the much the same thing I made a button that linked to the article so users could find it easily. The "go back" button didn't work to reopen it though and I suspect search engines wouldn't have known what to do with it.

Re: Why I hate your Single Page App

#44
post #37
post #29

+1000 The biggest things for me are probably the excessive amount of resources used, the long load times, how hard it is to get things "right" (like not breaking the back button) and links taking awhile to load because we have to load your stupid SPA (if they work at all). SPAs did win out big in one area though. On mobile. Except on mobile they're called "apps". As much as many HNers like to chafe against native mob…

How hard it is to get things right? It's not hard at all. It's builtin with frameworks like Ember or Angular, and for React you got react-router which does things correctly by default. It's just bad programming. I don't even understand why people would make an SPA without a url-router. Doesn't that just make development harder/more anoying? Why would links take longer to load in a SPA? CSS, Javascript and the like sh…

[deleted]

Re: Why I hate your Single Page App

#45

Why I hate your classic HTML app: - Every click is a full page load, and you still didn't manage to get caching right, so it takes 2 seconds to load. - When I have multiple tabs open, your badges and notifications fall out of date, because you never poll for updates. - If I mis-enter information into a form, your error handling forgets all my information and I have to re-enter it. - You forgot to update the styles on…

Since we're talking about poorly implemented features.

Why I hate your SPA:

- If I click on a link, I receive no indication that I actually clicked a link, then 2-10 seconds later the page abruptly loads. Sometimes the page doesn't load at all.

- I cannot tap and hold a link, wait a second for the pop-up menu, and open the link in a new tab because the link isn't actually a link. It's implemented in JavaScript.

- The back and forward buttons don't work as expected because either history isn't maintained or it's shoddy (scrolling should not be a history event).

- The refresh page button don't work as expected because it resets you to the beginning.

Re: Why I hate your Single Page App

#46
Lot of SPAs I have seen also reinvent the desktop. They have their own tabs and dashboards. And they do it badly - no shortcuts, no integration with the file system..

Re: Why I hate your Single Page App

#47

Why I hate your classic HTML app: - Every click is a full page load, and you still didn't manage to get caching right, so it takes 2 seconds to load. - When I have multiple tabs open, your badges and notifications fall out of date, because you never poll for updates. - If I mis-enter information into a form, your error handling forgets all my information and I have to re-enter it. - You forgot to update the styles on…

"[each click] takes 2 seconds to load"

In about 95% of the SPAs I've tried, each click takes even longer than that.

"you never poll for updates"

Yes, because apparently AJAX/AJAJ is completely nonexistent and there's absolutely zero ground between "pure-HTML like it's 1991" and "VueWangulaReact.js single-page monstrosity".

Hell, even a meta-refresh will fix that if you really do want "pure-HTML like it's 1991", though that's certainly inelegant.

Re: Why I hate your Single Page App

#48
post #37
post #29

+1000 The biggest things for me are probably the excessive amount of resources used, the long load times, how hard it is to get things "right" (like not breaking the back button) and links taking awhile to load because we have to load your stupid SPA (if they work at all). SPAs did win out big in one area though. On mobile. Except on mobile they're called "apps". As much as many HNers like to chafe against native mob…

How hard it is to get things right? It's not hard at all. It's builtin with frameworks like Ember or Angular, and for React you got react-router which does things correctly by default. It's just bad programming. I don't even understand why people would make an SPA without a url-router. Doesn't that just make development harder/more anoying? Why would links take longer to load in a SPA? CSS, Javascript and the like sh…

> My SPA's come in at around 120-130kb minified (no gzip).

react-dom is just a touch bigger than that alone, fwiw

Re: Why I hate your Single Page App

#49
A very bizarre article I feel.

Stefan identifies common pitfalls or shortcomings of most single page applications such as:

1. Bad performance because of too many operations

2. Breaking browser navigation buttons

3. Not having unique links/anchors to in-page content.

While there are in fact multiple ways of bringing focus and solving these problems the authors suggests that simply ditching SPAs for native toolkits or backend/frontend system is the way to go.

While switching away from SPAs might mitigate the problems listed above - it will also present new problems that developers have to tackle - or simply spend time on.

The main problem here is how hard the problems he describes are to deal with in current frameworks I believe. He has one thing 100% right - bringing attention to those problems is the right way to go.

Re: Why I hate your Single Page App

#50

Why I hate your classic HTML app: - Every click is a full page load, and you still didn't manage to get caching right, so it takes 2 seconds to load. - When I have multiple tabs open, your badges and notifications fall out of date, because you never poll for updates. - If I mis-enter information into a form, your error handling forgets all my information and I have to re-enter it. - You forgot to update the styles on…

Since we're talking about poorly implemented features. Why I hate your SPA: - If I click on a link, I receive no indication that I actually clicked a link, then 2-10 seconds later the page abruptly loads. Sometimes the page doesn't load at all. - I cannot tap and hold a link, wait a second for the pop-up menu, and open the link in a new tab because the link isn't actually a link. It's implemented in JavaScript. - The…

Just to be clear, that is a poorly designed SPA, none of that should be happening and is easy to avoid.
Post reply on HN