Comment by donatj

4 years ago

I have in my life used a couple of SPAs where I thought "Man, this works really smoothly and quickly!" Like there have seriously been a couple really good ones.

They absolutely can be done right, I've built one I think is done right. I've built a couple. I don't think the average team has it in them to build a good SPA.

The majority of SPAs are user hostile hot garbage.

The 95% of other SPAs were full of minor frustrations that could have been easily avoided by not being an SPA including

  1. Completely unhandled errors with no indication anything is wrong. 
    - This is a majority of SPAs. Any request error on flakey internet? Don't bother tell the user, just break.
    - The sheer number of times I've needed to open inspector to see that something has gone wrong… At least an actual non-SPA request that fails will show you an error page.  
  2. Broken… native… everything 
    - 2.1 Especially "broken open link in new tab"/middle click - see next.
  3. Inability to run the site in multiple tabs.
    - State is entirely local so state gets broken *easily*.
    - Some just outright refuse and warn you.
  4. Adding everything I do to the browser history api
    - Makes it even worse than the back-button-not-working of old. Have to hit back a thousand times.
    - Scrolling SHOULD NEVER add things to my back button. NEVER.  
  5. High CPU usage on a site doing seemingly nothing
    - Looking at you, Medium.  
  6. Generally being way slower to use than the previous non-SPA website
    - Looking at you, Wells Fargo.
  7. LOSING MY POSITION ON HITTING BACK
    - The sheer number of times I've been scrolling down an infinite list for like 30-45 seconds, click on something, nope not what I wanted, hit back, returned to the top of the list is entirely unacceptable as a society.
    - This is very often combined with 2.1 and 3 to make for a truly infuriating experience

Like don't get me wrong, you can do a lot of this junk in a non-SPA but the failure state is almost always better.

> Inability to run the site in multiple tabs. State is entirely local so state gets broken easily.

I have seen this more for sites where a TON of state is stored in the backend, the site expects the user to have 1 tab that is kept in sync with what the server thinks that user session is doing.

Heck I have seen sites that throw up errors asking me not to open multiple tabs.

I have also seen sites where if I have Tab 1 on Page A, and I open Tab 2 to Page B, then go back to Tab 1 and navigate to Page C, if I go to tab 2 and try to navigate anywhere, it just goes to Page C.

Fun times when the server has too much state.