3 ms·
Do social media sites really need to be SPA's? Does Twitter or Reddit really have to be a SPA? Do Reddit really need the UI = f(state) paradigm? Is there much
by bestinterest 6y ago
Do social media sites really need to be SPA's? Does Twitter or Reddit really have to be a SPA?
Do Reddit really need the UI = f(state) paradigm? Is there much of any complex cross component state sharing that an SPA would be valuable there?
Here is an example of Hotwire with Twitter https://twitter.com/tonysmdev/status/1355996616361205760 https://twitter.com/tonysmdev/status/1355996616361205760
- mixedCase 6y agoNope, they absolutely don't! And Reddit's SPA is a good example that is markedly worse than their old website. I was thinking of Facebook. Twitter (and things like Instagram and TikTok) in particular is something where an SPA makes it easier to handle the different sections like the main feed, DMs, lists while keeping it responsive, but for those cases tools like LiveWire and Hotwire help make the gap between sites and SPAs much smaller and are an asset for avoiding having to rewrite websites into SPAs just for those smaller things. But then you have cases like YouTube, where you could've argued that the initial case was a perfect fit for a website, and then as it has incorporated features like notifications, livestreaming with live chat, live donations with payment flows on top of the video and smaller things like the mini-player... you would end up with a huge amount of imperative JS sprinkled around your templates and carefully managed around your LiveView-equivalent's state updates; or you could just go with an SPA, vastly simplify your backend to be concerned on handling your data efficiently, and just having a frontend that makes managing complex state updates not-as-horrible. It's trade-offs all the way down.
- bestinterest 6y agoAgreed, but I think an SPA feels like optimizing way too early because of how far it seems you can get now with Hotwire etc. Also with the pace of SPA's at the moment its a risky bet 2015 React code is nothing like 2021 React code with hooks and functional components etc. And Svelte is a new challenger which I really like but I'd try to avoid a lot of the SPA's as much as possible but when you have a page which clearly needs it you can drop it in. I hope we can somehow find a way to collapse the barriers a little more of SPA/SSR only and have 'sprinkles' of SPA when you need it for certain pages like large booking calendars or such. Maybe that's a silly and complex idea though. But as you say if you were making a true 'appy app' today then that's an obvious SPA choice. Instagram I'm very iffy on if that needs to truly be a SPA too, sounds like some Hotwire turbo-frames around some things could do the trick but I'm being arrogant here as I'm unsure. Trade offs everywhere.