Live data from Hacker News

If Not SPAs, What?

macwright.com

71–80 of 456 posts

Re: If Not SPAs, What?

#71

IMO, TurboLinks + service workers are the way to go. Not many people know this, but a service worker (previously called "local server") allows you to run a little web server in the user's browser that intercepts requests to your own web site. (There's no open IP port.) The service-worker web server can proxy requests to the remote server, and even build/store entire pages on the client side, enabling offline support.…

Strongly agreed that service workers have a ton of potential here. But I’m still waiting for there to be some kind of killer framework that crosses the bridge between worker and window, saving lots of main thread processing, etc... MessageChannels are quite low level so I imagine it would need some abstraction. But still, very powerful. I’m imagining some kind of Svelte-like thing that creates the whole page worker-side, then generates minimal window-side JS to hydrate the components that’ll actually change. Of course I’d make it myself, but... oh, look over there...

(IMO they should still be called local servers, or server workers perhaps. Service worker is too vague)

Re: If Not SPAs, What?

#72
post #70

You can achieve near SPA performance with XSLT in the frontend, and stitching multiple XMLs using it. - No JS fallback by default - Naturally friendly to XML database backends - Huge cache hit improvements - Effectively, you get the functionality of the now abandoned "seamless" iframe attribute

Yeah but then you have to use XSLT.

(Jokes aside, I tried this years ago hoping for it to be a magic bullet. Gzipping meant that the bandwidth savings weren’t anywhere near what I hoped and XSLT is a PITA to deal with)

Re: If Not SPAs, What?

#73

Micro front-ends and packaged business capabilities. Build encapsulated domains (views, events, apis, data store) with their own dependencies (not shared with umbrella app) and pluggable with meta data.

I genuinely understood nothing to that comment. Are you talking about frames? Please develop.

Re: If Not SPAs, What?

#74
post #50

I've had great success with the Turbolinks + Stimulus approach. There are a couple of common patterns that you'll reach for, namely, lazy loading content (basically a with a URL attribute that you have Stimulus load via AJAX) and really leaning into Rails remote-link / server javascript responses for modals and little page updates. It's so great to still be super productive and be able to crank out several pages of a…

curious how you would implement refresh of a single row in a table after a job has completed? have enjoyed this combination too, but I feel like you'd have to subscribe to multiple ActionCable channels to do this?

Re: If Not SPAs, What?

#75
post #72
post #70

You can achieve near SPA performance with XSLT in the frontend, and stitching multiple XMLs using it. - No JS fallback by default - Naturally friendly to XML database backends - Huge cache hit improvements - Effectively, you get the functionality of the now abandoned "seamless" iframe attribute

Yeah but then you have to use XSLT. (Jokes aside, I tried this years ago hoping for it to be a magic bullet. Gzipping meant that the bandwidth savings weren’t anywhere near what I hoped and XSLT is a PITA to deal with)

Tons of 10+ years old bugs in Chrome, yes, full of hacks, but it's doable.

Re: If Not SPAs, What?

#76
post #45

One entry in this space that doesn't get a lot of attention is ASP.NET Blazor [1]. Blazor gives you the option of writing views in C# that will actually compile to WebAssembly and run in the browser, or run on the server and send DOM updates over a SignalR connection, a lot like LiveView. [1] https://docs.microsoft.com/en-us/aspnet/core/blazor/

Last time I looked it couldn't run in the browser, and there was no ETA, has that changed?

Re: If Not SPAs, What?

#77
post #8

I think Phoenix Live View is maybe the most compelling story around this ( https://github.com/phoenixframework/phoenix_live_view ). I'm moving a side-project from React/SPA to Phoenix live view and it's kind of amazing to get the dev ergonomics of a server-rendered page with the UX benefits of a SPA. This course is a pretty great intro: https://pragmaticstudio.com/phoenix-liveview

Agree completely. My only concern is that so many imitations are attempting to pop up in other languages and you just can’t do it as effectively. There are so many tradeoffs present that happen to result in the necessary set of functionality to do this efficiently that aren’t easily present outside of the BEAM.

[deleted]

Re: If Not SPAs, What?

#78
I'm building an app with a TALL stack now (Tailwind, Alpine.js, Laravel, and Livewire) and I am incredibly productive. Very little build step required (to compile Tailwind to reduce the size based on which classes are used in .blade.php files). CRUD, Image uploads etc are so easily done I am such a fan. I was skeptical at first, but now I love this way of building web apps. No idea how well it scales, but for a simple MVP I couldn't have asked for a better stack.

Re: If Not SPAs, What?

#79
post #52

I've been building a site with Svelte/Apollo/Hasura. It's been pretty amazing so far. I think if you can get away with not needing SEO it's hard to beat. That said, something that requires a lot of thought is not just constantly displaying spinners. When I look at projects built by experienced FEs it seems like there's a lot of patterns to work around this that I'm not aware of.

> That said, something that requires a lot of thought is not just constantly displaying spinners. When I look at projects built by experienced FEs it seems like there's a lot of patterns to work around this that I'm not aware of

I'm not sure what patterns you're thinking of. To me this just sounds like implementing caching and background fetching.

Re: If Not SPAs, What?

#80
I saw this SPA performance issue when interacting with Azure and GCP console. AWS console, on the other hand, is mostly non SPA and responds super fast. It didn’t feel jarring and loaded very quickly. It had a questionable UI, but I feel that AWS might have noticed that SPA would ruin the UX of navigating consoles. It is a small thing, but a big reason why I prefer developing with AWS. GCP comes close second in terms of performance with a SPA. Azure just shits the bed and seems like a pile of mess. What has your experience been like?
Post reply on HN