question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ergonomics when always serving full-page responses

See original GitHub issue

One of the differences between htmx/intercooler and unpoly is that unpoly by default assumes that the backend is serving full pages in responses rather than page fragments. As I am using htmx to enhance a site that should otherwise be perfectly functional without JS, the backend always serves full pages and never partial templates.

Additionally, I’m not sure what your typical sites look like, but I find that I almost never want to swap the element that is being clicked but rather some other element (this is also made easier by the fact that the entire page is served up by the backend, so things like buttons that have text that needs to be changed depending on the context are usually swapped out altogether with the element that is being affected by simply swapping a parent of the button and the results). As a result, all my htmx usages end up extremely verbose and redundant (especially because of #23 and #24), e.g. to simply swap a single element when a checkbox is altered:

<label><input type="checkbox" name="hideIncomplete" hx-get="/Registrations" hx-push="true" hx-target=".registrations" hx-swap="outerHTML" hx-select=".registrations" /> Hide incomplete registrations</label>

I wonder if there’s a configuration option that could be added or else an alternate syntax that could be used that would bundle all this in one to reduce the boilerplate (and chance for error).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
1cgcommented, May 24, 2020

I’m warming up to the idea that in the absence of an explicit target and swap, hx-select should define the target as the same item and the swap as outerHTML.

2reactions
BoPengcommented, Jan 9, 2021

I am not quire sure what this ticket is about but I am just writing to send a big kudos to hx-select since I simply convert my links from

          <a class="nav-link" href="/about">About</a>
          <a class="nav-link" href="#" hx-get="/about" hx-target="#page-content" hx-push-url="true"
            hx-select="#page-content">About</a>

to avoid the complete reload of my webpage, without the need to change anything in the backend!.

I cannot remember if this could be done in intercooler.js but I am really happy to use htmx now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ergonomics - Overview
Involve Workers - A participatory ergonomic approach, where workers are directly involved in worksite assessments, solution development and implementation is ...
Read more >
Computer Ergonomics: How to Protect Yourself from Strain ...
Ergonomics is a field of study that attempts to reduce strain, fatigue, and injuries by improving product design and workspace arrangement. The goal...
Read more >
craftsman 100 ac infinite amp arc welder manual
Requires 30amp or greater single phase 110/120vac service. Craftsman ARC WELDER Operation & user's manual (8 pages) Pages: 8 | Size: 0.
Read more >
GMMK PRO 75% Custom Keyboard (Black)
Brass provides a firm tactile response, while polycarbonate is more cushioned ... red, blue and brown switches, always chasing that perfect sound and...
Read more >
Automation And Robotics: Tending To The Culture Side Of ...
And the market's largest segment is service robotics. ... Humans will always want to be more important than robots and viewed at the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found