Live data from Hacker News

If Not SPAs, What?

macwright.com

61–70 of 456 posts

Re: If Not SPAs, What?

#61
post #55

HTMX https://htmx.org/ LiteDOM https://litedom.js.org/ Stimulus https://stimulusjs.org/ Turbolinks https://github.com/turbolinks/turbolinks

Stimulus Reflex https://docs.stimulusreflex.com/

Laravel Livewire https://laravel-livewire.com/

Phoenix LiveView https://github.com/phoenixframework/phoenix_live_view

That's where I see a lot of potential. With Stimulus Reflex I have the convenience and development speed of Rails and I can enhance it with StimulusJS sprinkles and reflexes to create great experiences for the user. The interactivity I get is enough for 90%+ of the webapps out there and the complexity to do it is far less.

Re: If Not SPAs, What?

#62

Our app ( https://domestica.app/login ) is a pretty good (IMO) example of a blazing fast SPA. It uses Mithril and copious amounts of chunking to make the bundle size extremely small.

This is one of the worst SPAs I've ever seen, simply because it causes an infinite redirect loop when clicking the back button and/or tampers with the browser history to make using the back button impossible.

Just tried the app and immediately found the typical SPA bugs and quirks:

- tried to add a recipe and nothing happened for so long (3-5 seconds) that I thought it was broken. Then suddenly the add recipe form finally appeared. Blazing fast! On your dev laptop maybe.

- click payee, nothing happens. URL changes though. God I hate SPAs

- adding an item to your shopping list causes a 'item added' popup to appear. Over the add item button so you can't add another item without dismissing the popup. It's probably only an issue on mobilr, but this popup is only necessary because it's a SPA

- I'm on the 'create shopping category page'. Try and click the 3 dot thing in the top right. The new menu appears underneath the body of the page...

- on the recipe page, you can click the M? button and it displays a link about 'markdown'. Click the link, it takes you to a blank page, which then redirects back to the homepage after a second or two. Bye-bye all your existing input

- this is more of a bug, but if you try and use markdown in the directions text box for recipes, you can't. Start with a # and all your input just disappears (Firefox mobile)

A few other comments I'd add:

- Get a designer, or maybe buy an off the shelf design. That green is err, not nice. The design looks like a developer made it. I'm not great either but you can get a decent design, based on bootstrap or whatever, for like $50 and just adapt it. There are even free designsz like AdminLTE

- why are the top corners of the input boxes rounded, but the bottom corners square?

- Every time I go to the login screen, the logo pops in later than the rest of the screen. And then the Google login pops in even later. I'm on my mobile so can't check, but that screams bad browser cache settings on your images/static assets

- why are the + buttons slightly elliptical instead of round? Looks odd

I generally like the idea behind the app though, though won't use it as it's all in $s. I wonder how much traction you're going to get though as it's going to be really intensive setting it all up

Re: If Not SPAs, What?

#63
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.

What about this can't be done with async/await?

Re: If Not SPAs, What?

#64
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.

Re: If Not SPAs, What?

#65
Well, we could go back to the original model for the web, using REST & HATEOAS without arguing or even really thinking about it, by building hypertext-based applications.

Of course, the hypertext we have, HTML, wasn't completed, and it leaves a lot to be desired. I have tried to fix that with htmx:

https://htmx.org

Re: If Not SPAs, What?

#66
post #60

I think there is another layer to that conversation. Frameworks become bureaucratic and boring because they are developed by large teams for large teams. Most developers are working on small projects and need more fun and less maintaining huge amount of boilerplate code that recreates the browser. The framework that I feel makes development less ugly is svelte. But still, I really don't like the idea of heavy client…

I went down this route recently. There are a couple of different options depending on your preference:

• Write the glue code yourself if you only need svelte on a few pages • Inertiajs if you want to replace your view layer with svelte

Re: If Not SPAs, What?

#67
I think if Chrome changes to the omnibox really click. The need for SPA in general will dwindle. You cannot see the URL so if it is ugly who cares. And if the page refreshes fast enough most end users will not be able to tell you are on a SPA or not.

Re: If Not SPAs, What?

#68

Earlier quoted context omitted.

This is one of the worst SPAs I've ever seen, simply because it causes an infinite redirect loop when clicking the back button and/or tampers with the browser history to make using the back button impossible.

Just tried the app and immediately found the typical SPA bugs and quirks: - tried to add a recipe and nothing happened for so long (3-5 seconds) that I thought it was broken. Then suddenly the add recipe form finally appeared. Blazing fast! On your dev laptop maybe. - click payee, nothing happens. URL changes though. God I hate SPAs - adding an item to your shopping list causes a 'item added' popup to appear. Over th…

Thank you for the feedback! We'll take a look at these, especially the recipe form. For the shopping list alert issue, you should be able to dismiss the alert but I see where you're coming from. Regarding the colors, you can set whatever color scheme you want under your account settings. The images have always given us trouble, they should be cached but the painting seems like it occurs after load for some reason (I think it has to do with auto height/width?). It's annoying, and will be prioritized soon.

Re: If Not SPAs, What?

#69
post #2

If you can do server side great: do it. The difficulty is accurately predicting how much JavaScript you'll end up writing. If your client-side JavaScript is comparable in complexity to your SSR you'll eventually end up with the worst of both worlds.

Is it really that difficult? If a client tells me what they want built, I bet I'd be able to roughly guess how much js there's going to be, probably within a few hundred lines for a, say, 3 month project. The larger the project, the large the margin of error, but still, it's really not that hard for the vast majority of work we do. Or at least I do, e-commerce, enterprise apps, etc.

That sounds logical if you are doing client work with a defined scope. From personal experience working in the startup world, which I imagine a lot of posters on here are, you don't always know what you are building or what the end game is.

Re: If Not SPAs, What?

#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

Post reply on HN