News for hackers. Stuff that matters.
Re:Htmx Is the Future by cogman10 on Friday May 05, 2023 @01:15PM (#35832299)
It's not clear to me, but how and where is state managed?

In the OPs article, it looks like the only thing going over the line is UUIDs. How does the server know "this uuid refers to this element"? Does this require a sticky session between the browser and the backend? Are you pushing the state into a database or something? What does the multi-server backend end up looking like?

Re:Htmx Is the Future by recursivedoubts on Friday May 05, 2023 @01:17PM (#35832321)
Re:Htmx Is the Future by ukuina on Friday May 05, 2023 @08:00PM (#35836597)
Doesn't this make serverless read-only apps (that only require a fileserver) effectively impossible?

In a serverless read-only app, all business logic and state is maintained on the browser.

Re:Htmx Is the Future by _heimdall on Friday May 05, 2023 @10:13PM (#35837312)
Serverless and static are different. Static sites will likely be limited to maintaining state in the browser. Serverless is terribly named but still have a short lived server with access to request query parameters, cookies, headers, and a database depending on your setup
Re:Htmx Is the Future by decross on Sunday May 07, 2023 @08:41PM (#35856945)
You can embed a "backend" as a service worker and use htmx to interact with it. A proof of concept here: https://github.com/richardanaya/wasm-service
Re:Htmx Is the Future by ukuina on Monday May 08, 2023 @01:50AM (#35858540)
This is cool!

A possible extension to HTMX would be to allow this kind of offloading to pure JS functions instead of requiring hacky intercepts.

You would still have a clear separation of responsibilities between frontend rendering (by the browser only) and application logic (which only generates HTML as output).

Re:Htmx Is the Future by nymanjon on Sunday May 14, 2023 @04:31PM (#35941134)
I've done the same thing with vanilla JS in a service worker. I did it with my HTMF library -- similar to HTMX -- but not production ready and based on forms rather than being able to put your attributes everywhere. I'll have to create a simple to do app with HTMX that shows this same functionality. The Rust one is cool as you can do it with 150kB library. But I can do the same thing with 10kB with just simple JS.
Re:Htmx Is the Future by lakomen on Saturday May 06, 2023 @07:45AM (#35840359)
I hate HATEOAS with a passion.

Yet another useless Java gimmick with no support other than 1 single framework, Spring Boot.

If htmx has anything to do with HATEOAS it's going to be ignored out of principle.

Re:Htmx Is the Future by _heimdall on Saturday May 06, 2023 @11:46AM (#35842481)
Mind sharing why you have such strong opinions on HATEOAS?

Is you problem that there aren't many implementations of it today or concerns with the architecture itself?

Re:Htmx Is the Future by recursivedoubts on Sunday May 07, 2023 @05:13PM (#35855646)
That's because you are using in a JSON API context, where it doesn't make any sense.

HATEOAS (or, as Fielding prefers to call it, the hypermedia constrain) is a necessary component of a truly REST-ful networking system, but unfortunately the language around REST is all jumbled up.

I try to explain why this is here:

https://htmx.org/essays/how-did-rest-come-to-mean-the-opposi...

and I try to explain what HATEOAS really is here:

https://htmx.org/essays/hateoas/

and I try to explain why HATEOAS has been, by and large, a failure outside of true hypermedia clients presenting directly to humans here:

https://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.h...