Hacker News new | past | comments | ask | show | jobs | submit login

> it all started with the desire to eliminate blank screens in between pages and reduce payload sizes

Hell, no.

The "two main reasons" for single page app given at the beginning (faster app, reduced network traffic) are actually not the main one. The main one is that the browser loses its state at each page reload, and that the state on the server, if any, needs to be reconciled every time with that on the browser. It is fine only as long as your app doesn't have any client state. The more state you put in your client (e.g. a text field with its contents) the harder it is to maintain the state across page reloads.

This is why now we design our applications with all the state in the frontend, closer to the user, and a stateless backend. SPAs are in fact enormously simpler than equivalent non-SPAs.




> it all started with the desire to eliminate blank screens in between pages and reduce payload sizes

That isn't even a thing anymore, except in SPA's or Internet Explorer; Chrome (seems to?) wait until some content is loaded before it switches to the clicked page, there is no blank screen.

Payload sizes is not really a problem either given that content is not that much data. Images and media take up the brunt of bandwidth; the payload size is not the issue.


>The main one is that the browser loses its state at each page reload, and that the state on the server, if any, needs to be reconciled every time with that on the browser.

Yes, I also noticed this flaw. There is no good way of dealing with this other than saving state into localStorage which is less than ideal.


Traditionally you'd save it in the session on the server


And that really underscores the OP's point. With SPAs your servers no longer need to scale linearly with your user base. You don't have to solve all the myriad problems that come with maintaining state for all users in a centralized location.


I think those are definitely some key advantages to SPAs, but my impression when they started becoming adopted, especially to the consumers (users) was one seamless thing with no new pages etc.. certainly development is more manageable with client only state, but I don't see that as the first big sell.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: