Hacker News new | ask | show | jobs
by potamic 923 days ago
You seem to be using htmx? Pretty impressive to get this much interactivity without much javascript. Would be very interested to learn more about how it's working out overall.
1 comments

I am! It's my first HTMX project but I am liking it so far. HTMX has a few quirks which it took me a while to understand, but since then it has worked pretty well -- the amount of HTMX "code" I've had to write is quite small compared to the amount of JS I'd normally have to write.

My main takeaways have been:

- It mostly just works and simplifies things, but:

- Working with page state (in my case, which sheet is loaded) in individual requests (like updating a cell) is a bit awkward -- you can either supply it via `hx-vals` or via setting a global hidden input which is specified via `hx-include`. I ended up going with the second approach due to https://github.com/bigskysoftware/htmx/issues/1119 but it's not perfect -- in particular you need to duplicate specifying the input if you want to include additional inputs for some node.

- Error handling is also a bit awkward, but it's not too bad once you get used to the idea that you should return HTML elements in 400s. I found https://htmx.org/extensions/response-targets/ helpful as well. - Often HTML structure doesn't allow you to limit your request scope as much as you'd like. For me the big thing is I can't just replace one column since tables are row-major -- I have to replace the whole table if a column is modified.