htmx icon indicating copy to clipboard operation
htmx copied to clipboard

alpine-morph swapError re().body is null

Open danbluhmhansen opened this issue 1 year ago • 2 comments

I get an error using hx-boost="true", hx-ext="alpine-morph", and hx-swap="morph".

image

I'm using htmx version 1.9.10, alpinejs version 3.13.5.

The requests do return a 200 OK result with valid HTML.

I did find #786 which seems related, but my error always happens no matter what speed I click around with.

danbluhmhansen avatar Feb 20 '24 19:02 danbluhmhansen

I also encountered it. Errors disappeared in my case, when I replaced:

<body hx-ext="morph">
  <!-- content -->
</body>

with

<body>
  <div id="page" hx-ext="morph">
    <!-- content -->
  </div>
</body>

I did not yet dig, exactly why... but maybe just adding id fixes it...

PyrekP avatar Feb 22 '24 11:02 PyrekP

I got mine working again by changing hx-swap="morph" to hx-swap="morph:innerHTML". Setting ids didn't change anything for me.

Perhaps the alpine-morph extension documentation should mention setting the above value when using it for boosting?

danbluhmhansen avatar Feb 22 '24 14:02 danbluhmhansen