Open craigharman opened 3 months ago
Hey, took a quick look, it seems that both disableElements
and addRequestIndicatorClasses
in the core, increment an internal requestCount
property, and remove their associated classes when that count reaches 0.
I would guess that the issue is, since removeRequestIndicators
processes the indicators (thus htmx-request
) first, for an element that has both attributes, as for a single request the count will be 2 (as indicator + disable-elt incremented it), the count is 1 when decrementing and processing htmx-request
, in which case the class is not removed (check is against a 0
value), then the disabled attribute is properly removed as the count reaches 0.
Didn't spend more time than this so there might be more to it, but if you feel like investigating, a bugfix PR would be welcome! I suspect this could even be a problem with the lib itself (with that double count thing) and not the extension, but this needs confirmation!
If you have an element that uses
hx-target-error
andhx-disabled-elt
and get an error response backhtmx-request
class doesn't get removed. It does if you removehx-disabled-elt
.eg. This keeps
.htmx-request
class on elements:<form hx-post="/tip" hx-target="#targetDiv" hx-swap="outerHTML swap:1s show:top" hx-trigger="click" hx-target-error="#showError" hx-disabled-elt="this">
While this removes them:
<form hx-post="/tip" hx-target="#targetDiv" hx-swap="outerHTML swap:1s show:top" hx-trigger="click" hx-target-error="#showError">