News for hackers. Stuff that matters.
Re:Htmx Is the Future by OliverM on Friday May 05, 2023 @12:37PM (#35831733)
I've not used Htmx, but a cursory browse of their docs gives https://htmx.org/extensions/multi-swap/ which seems to solve exactly this problem. And thinking about it, what makes it as difficult as you say? If you've a js-library on the client you control you can definitely send payloads that library could interpret to replace multiple locations as needed. And if the client doesn't have js turned on the fallback to full-page responses solves the problem by default.

Of course, I've not used Turbolinks, so I don't know what issues applied there.

Edit: I'm not saying htmx is the future either. I'd love to see how they handle offline-first (if at all) or intermittent network connectivity. Currently most SPAs are bad at that too...

Re:Htmx Is the Future by dfabulich on Friday May 05, 2023 @01:39PM (#35832590)
Multi-swap is possible, but the declared HTML components typically don't have access to the state they need to make decisions about how to multi-swap.

If you need multi-swap, you'll find it orders of magnitude easier to switch to a framework where the UI is a pure function of client-side state, like React or Svelte.

Re:Htmx Is the Future by nymanjon on Sunday May 14, 2023 @04:33PM (#35941149)
You should be able to do this with events in HTMX also. So, you could do an update or create something and then in HTMX capture the event and reload the component when that happens.