@_chrismay how to improve the dev experience that you get by adding htmx to a Django project? Install django-htmx, and some sort of a partials renderer like django-template-partials, anything else?. How to improve DX when your htmx views error out?
@_chrismay I often encountered the problem of additional JS not working properly. For example in forms with tinyMCE, or even when I used some custom hyperscript that‘s loaded with the form. The browser tries to execute the code referenced in the loaded HTML partial before the external ressource is loaded and parsed. Mostly happens on first load (afterwards, the JS file is cached), but also when returning to a form after validation error. Simple problem, but I couldn‘t reliably fix it. 🤔
@_chrismay I‘ll put something together. I have a few simple examples in mind. 👍 Maybe I‘ll even be able to produce a (hacky) solution for the examples - your hypothesis is most probably correct.
@_chrismay we are missing a good intro that walks through the quick wins aka the AJAX hx-(get|post|delete|*) with some example Django view code would be helpful to point people to.
Then hx-trigger + hx-swap + hx-target basics would have helped me with a practical example.
@_chrismay I want to understand it’s limits. I assume there are still some things we need react or Vue for. But what are those things? Or is my assumption wrong?
@shacker@_chrismay And of course, important to remember that it doesn't have to be an either/or scenario. The idea is recognizing what htmx is good for and leaning into that.
@pythonbynight@_chrismay Thanks for the input, and for the link. Very good read. TLDR; for me was 1) Not great when you need to update the DOM in multiple places at once; 2) Not great when you need to control totally different parts of the page. That really helps bring things into focus, thanks.
@shacker That said, I had my doubts about how complicated the code is for that tool. In the heat of deadlines, it's hard to have clear vision.
I talked with another developer about handing the in-page complexity to a front-end JS framework.
Since that discussion, I realized I should have used Contexte's strategy of raising JS events when updating the page. That would have simplified a lot of the code.
@_chrismay Thanks for the input, and for the link. Very good read. TLDR; for me was 1) Not great when you need to update the DOM in multiple places at once; 2) Not great when you need to control totally different parts of the page. That really helps bring things into focus, thanks.
Add comment