Live data from Hacker News

It's time for modern CSS to kill the SPA

jonoalderson.com

101–110 of 516 posts

Re: It's time for modern CSS to kill the SPA

#103
post #99

"... someone says the words. A CMO. A digital lead. A brand manager. ... it’ll be an SPA." Why not spell out CMO and SPA and a civilian such as myself will not have to toddle off and dig out a search engine? If you are going to get all assertive and pissed off, please be inclusive too.

The problem is he's confidently wrong in believing Single Page Applications are about page transitions. Not at all. It's more about keeping state and an application-like experience. Like playing a song on spotify and changing to the search page and the song keeps playing... that type of thing.

Re: It's time for modern CSS to kill the SPA

#104

I'm fully convinced that it's time to kill SPAs on 99% of websites and that the community is too defensive on the topic.

I agree. SSR that hydrates to an SPA is a pain in the butt and not necessary most of the time. This is why I favor something like Astro for websites... I can drop in a react embed when I need to. It's just a right-tool-for-the-right-job situation imo.

Re: It's time for modern CSS to kill the SPA

#105
I was completely unaware of view transitions and speculation rules. All of my products are server rendered for speed and simplicity. It’s amazing how snappy the interface is when your pages just load quickly because your software is performant. These seem like a great way to add an extra 10% of flavour.

Re: It's time for modern CSS to kill the SPA

#106

Earlier quoted context omitted.

In almost all cases the back swipe in the spa resets you to the top of the page, navigating out of the app and back in doesn’t work, etc. It’s really hard to build a multi page spa that feels good.

Never thought about scroll position (tho SPA I’ve built recently I think does it ok). How do you solve it?

I write some of my thoughts on this sone years ago. The library described at the end is now fairly out of date but the ideas and suggestions are still good, I think.

https://dev.to/cyco130/how-to-get-client-side-navigation-rig...

Re: It's time for modern CSS to kill the SPA

#108
The thing about SPAs is that computation can be done in the customer's machine. That usually makes it worse for everyone, both devs and users (although sometimes it doesn't). I personally believe that we can create better experiences routing more pages with more imagination, but at times this industry is quite vocal on what "user expectations" are.

Re: It's time for modern CSS to kill the SPA

#109

Earlier quoted context omitted.

In almost all cases the back swipe in the spa resets you to the top of the page, navigating out of the app and back in doesn’t work, etc. It’s really hard to build a multi page spa that feels good.

Never thought about scroll position (tho SPA I’ve built recently I think does it ok). How do you solve it?

Depends on what you're using for routing.

In Tanstack Router it's a boolean you set when creating the router. The documentation nicely lays out what's being done under the hood, and it's quite a bit.[1] I wouldn't try that at home.

In React Router you just chuck a somewhere in your DOM.[2]

[1]: https://tanstack.com/router/v1/docs/framework/react/guide/sc...

[2]: https://reactrouter.com/6.30.1/components/scroll-restoration

Re: It's time for modern CSS to kill the SPA

#110

I once worked at a place where (for involved reasons not worth rehashing for this conversation) some of the backoffice, admin pages got rewritten in SPA fashion, after they had already been written in server-side fashion. It was an accidental experiment that showed me that the backend code did not decrease in size, whereas the frontend ballooned up to the same size as the backend (for fairly simple functionality even…

I completely agree that SPAs are overused, but I also disagree that they necessarily balloon in size. An SPA is supposed to be a view, it is only supposed to concern itself with view logic. People just overcomplicate them endlessly with unnecessary crap.
Post reply on HN