Live data from Hacker News

htmx 2.0.0-beta1

v2-0v2-0.htmx.org

81–88 of 88 posts

Re: htmx 2.0.0-beta1

#81
post #49
post #4

I am interested in learning about how something is being used and in what context, instead of what it has to offer. Can anyone tell me if they are using HTMX in a proven environment, like a user-facing environment? I think adopting HTMX as a framework would be difficult to switch from a React, Vue, etc. environment. I think using it inside internal tooling or a hobby project will not be able to justify its merit. I u…

We use htmx (mostly via our django-livecomponents) on our production website, for several public facing features. We've initially replaced numerous small things that were built with Alpine before, and once we've gained confidence we rewrote our whole messaging app from reason/react app. Fun thing, customers find the new version (htmx/django-livecomponents) to be more responsive than the old version (react+REST). New…

> django-livecomponents

Sounds cool. This one?

https://github.com/om-proptech/livecomponents

Re: htmx 2.0.0-beta1

#82
post #38

Earlier quoted context omitted.

Super balanced & informative writeup, thank you. Can you tell me what you mean by tab sleep restoration?

Last year chrome started discarding background tabs to save memory, probably should have said discard rather then sleep it's been a while since I worked on that. Our user base keeps tabs in background often in mobile devices and we saw some reports of it. https://arstechnica.com/gadgets/2023/02/chrome-110-will-auto... When you do an htmx navigation to a new page, a discarded tab will "restore" only the last htmx frag…

Try adding the response header:

    Vary: HX-Request

Re: htmx 2.0.0-beta1

#83
post #72
post #26

Earlier quoted context omitted.

I'm using HTMX with Django for totem.org[0]. My over all experience is good. I'd say the main thing I like is testing. With a JS framework I have to have tests spread over both JS and Python, with HTMX I can mostly just focus on Python tests and assume the HTMX is going to work correctly. There's a good, stable testing story for Django, so I know the tests I write won't have to be rewritten all the time when dependen…

> The main downside I have with it though, is I just can't seem to remember how to use it I've noticed the more I use HTMX, the more I tend to end up needing to use the JS API too. For example, if I have an HTML table with inline editing, and I need there to be validation on what people are entering. So, I have HTMX firing when people save their changes via a button, then I need to use the JS API for conditional logi…

> So, I have HTMX firing when people save their changes via a button, then I need to use the JS API for conditional logic e.g., if valid, then update table. If invalid, then display some kind of message or whatever.

Couldn't that be handled server-side as well? I have my validation logic server-side, and it either returns the updated table row (or other element), or it returns the form again with validation/error messages, fields highlighted where the error occurred, etc.

Re: htmx 2.0.0-beta1

#84
post #63

Earlier quoted context omitted.

Nothing specific to React but having both client-side and server-side validation means that any deficiencies of server-side validation will be concealed and go unnoticed (until exploited by an attacker). In contrast, server-side validation only means any validation deficiencies are more likely to be discovered during legitimate usage since the client-side validation is no longer covering up for it.

I think you have it backwards. You _first_ do server-side validation, then you add client-side validation _as an optimization_, so that invalid requests are not even sent.

My point is that once you do that any subsequent deficiencies in your server-side validation become invisible during normal usage (because the client-side validation will prevent you from even trying).

Re: htmx 2.0.0-beta1

#85
post #82

Earlier quoted context omitted.

Last year chrome started discarding background tabs to save memory, probably should have said discard rather then sleep it's been a while since I worked on that. Our user base keeps tabs in background often in mobile devices and we saw some reports of it. https://arstechnica.com/gadgets/2023/02/chrome-110-will-auto... When you do an htmx navigation to a new page, a discarded tab will "restore" only the last htmx frag…

Try adding the response header: Vary: HX-Request

Yep, probably browser caching:

https://htmx.org/docs/#caching

Re: htmx 2.0.0-beta1

#86
post #82

Earlier quoted context omitted.

Last year chrome started discarding background tabs to save memory, probably should have said discard rather then sleep it's been a while since I worked on that. Our user base keeps tabs in background often in mobile devices and we saw some reports of it. https://arstechnica.com/gadgets/2023/02/chrome-110-will-auto... When you do an htmx navigation to a new page, a discarded tab will "restore" only the last htmx frag…

Try adding the response header: Vary: HX-Request

Next time I work on it, will try to see if that resolves it.

Re: htmx 2.0.0-beta1

#87
post #82

Earlier quoted context omitted.

Last year chrome started discarding background tabs to save memory, probably should have said discard rather then sleep it's been a while since I worked on that. Our user base keeps tabs in background often in mobile devices and we saw some reports of it. https://arstechnica.com/gadgets/2023/02/chrome-110-will-auto... When you do an htmx navigation to a new page, a discarded tab will "restore" only the last htmx frag…

Try adding the response header: Vary: HX-Request

That worked for me. Thank you.

Re: htmx 2.0.0-beta1

#88
post #81
post #49

Earlier quoted context omitted.

We use htmx (mostly via our django-livecomponents) on our production website, for several public facing features. We've initially replaced numerous small things that were built with Alpine before, and once we've gained confidence we rewrote our whole messaging app from reason/react app. Fun thing, customers find the new version (htmx/django-livecomponents) to be more responsive than the old version (react+REST). New…

> django-livecomponents Sounds cool. This one? https://github.com/om-proptech/livecomponents

Yes :)
Post reply on HN