Open anpin opened 1 year ago
Do you by any chance use web components or some JS lib? I'm completely unable to reproduce Error: A callback for the method 'component-update'
As for subscription not working after first swap, this is a legitimate bug, but it doesn't seem to be related with the error message you observe
Disregard everything above. For some reason I did not see error message in the console so my initial analysis was completely wrong
Basically, the following happens
Workaround with innerHTML is working because there is no attempt to access parent or sibling of the target, and there is a lot of guards for empty values, so when it's unmounted from the DOM, no errors happen.
I'll have to do more triagin, for I suspect that this may affect any cases when OOB swap replaces original target. Maybe the issue would have to be moved back to htmx repo
As a general tip, I would advise against using OOB swaps on existing targets. OOB is intended to be used for updates somewhere else on the page, whereas in your case you are handling the same target. Simply returning [1] without hx-swap-oob
from the hub works as expected
[1]
<div id="component" signalr-subscribe="echo" hx-target="this">Some new content here<div/>
Moving issue here from https://github.com/bigskysoftware/htmx/issues/1419
I'm using htmx
1.9.2
with htmx-signalr and it fails on this line https://github.com/bigskysoftware/htmx/blob/990cdd61a110bd497cb50d2286407ac6b7b64183/src/htmx.js#L948 withIf element received via signalr had
hx-swap-oob="outerHTML"
and some parent of the target hadhx-swap="outerHTML"
For example with such layout:
When extension receives
It replaces the content correctly, but then throws above exception after which any further updates would be ignored.
The workaround is to set
hx-swap="innerhtml"
on the target node in the original layout [1], so call togetSwapSpecification
here returnsinnerhtml
.[1] Workaround