<story><title>SPAs Were a Mistake</title><url>https://gomakethings.com/spas-were-a-mistake/</url></story><parent_chain><item><author>Zanfa</author><text>I think one of the unsolved problems of client-side interactivity on websites is how difficult it is to add it just &lt;i&gt;a little bit&lt;/i&gt; of extra client-side functionality to a traditional server rendered website. For example, recently I had to deal with photo uploads on a Rails app, which works fine out of the box at first, until you want to show progress bars and uploaded previews etc. Then you add a couple of client-side Stimulus controllers, maybe a Turbo frame here and there and it works, but then you get to browser navigation and you&amp;#x27;re screwed, because none of this works if somebody were to submit the form, then navigate back. Now you have to implement lifecycle handling to account for navigation and once you&amp;#x27;re done, you&amp;#x27;ve basically implemented a SPA, except it&amp;#x27;s broken into a mix of tightly-coupled Javascript, Ruby and ERB templates.</text></item></parent_chain><comment><author>dlisboa</author><text>The problem is the mixing and matching of state management. In a traditional web app all of the state is in the back end, in a SPA all of the state is in the front end. When we share state in between the two it&amp;#x27;s often messy.&lt;p&gt;To me the answer feels like it should be &amp;quot;traditional web app for most things, components-as-first-intended for some things&amp;quot;. The simplest React example is just one component that abstracts presentation and logic. The only state is its own. It does not handle an entire web app as a SPA, no Redux, prop drilling, it&amp;#x27;s just the idea of a reusable component as an HTML tag. Same with VueJS and all. If we restrict ourselves to that we&amp;#x27;re in the good path.&lt;p&gt;If there was already an HTML tag for your own specific problem, wouldn&amp;#x27;t you just use it in your traditional server-rendered app? A `&amp;lt;photo-upload url=&amp;quot;&amp;#x2F;photos&amp;quot;&amp;gt;` tag that does exactly what you want. Or a `&amp;lt;wizard pages=5 logic=&amp;quot;com.domain&amp;quot;&amp;gt;` tag. We should create just those components, either in React&amp;#x2F;VueJS&amp;#x2F;Whatever or in vanilla JS Web Components, and live with the rest as we used to.&lt;p&gt;We&amp;#x27;re basically saying that some parts of our apps are too difficult to mix and match state management, and we should offload all of the state to one of the two sides. In some rare apps indeed all of the state should be on the front end, but the use cases for that are just not as big as they&amp;#x27;re made out to be.</text></comment>
<story><title>SPAs Were a Mistake</title><url>https://gomakethings.com/spas-were-a-mistake/</url></story><parent_chain><item><author>Zanfa</author><text>I think one of the unsolved problems of client-side interactivity on websites is how difficult it is to add it just &lt;i&gt;a little bit&lt;/i&gt; of extra client-side functionality to a traditional server rendered website. For example, recently I had to deal with photo uploads on a Rails app, which works fine out of the box at first, until you want to show progress bars and uploaded previews etc. Then you add a couple of client-side Stimulus controllers, maybe a Turbo frame here and there and it works, but then you get to browser navigation and you&amp;#x27;re screwed, because none of this works if somebody were to submit the form, then navigate back. Now you have to implement lifecycle handling to account for navigation and once you&amp;#x27;re done, you&amp;#x27;ve basically implemented a SPA, except it&amp;#x27;s broken into a mix of tightly-coupled Javascript, Ruby and ERB templates.</text></item></parent_chain><comment><author>mattwad</author><text>I feel like most people that hate SPAs never have to deal with this type of thing, or even only have to work on the backend. They just don&amp;#x27;t get it. Of course, if you&amp;#x27;re using a SPA for a static website, you&amp;#x27;re also doing it wrong but that doesn&amp;#x27;t mean SPA itself is a bad thing.</text></comment>