imacrayon / alpine-ajax

An Alpine.js plugin for building server-powered frontends.
https://alpine-ajax.js.org
MIT License
558 stars 11 forks source link

[BUG] x-merge=prepend,append,update does not seem to work #45

Closed dephiros closed 8 months ago

dephiros commented 8 months ago

Hi, I am testing out the lib and stumble upon an unexpected behavior trying to follow the doc. Setting x-merge=append or prepend... does not seem to work. I added a codepen and loom below. Apologize ahead of time if I miss something obvious 🙏

https://codepen.io/dephiros/pen/dyrGPQN

https://www.loom.com/share/b0d4eecace2447d5a61e73caee930d50?sid=970f5462-e73b-4d05-804b-53fea9e65bc5

imacrayon commented 8 months ago

Hey An, thank you for the thorough bug report. Looking into this now.

imacrayon commented 8 months ago

Yeah, so v0.4 changed x-merge to a proper Alpine directive instead of a plain HTML attribute. This meant that if x-merge wasn't inside an Alpine component (initialized with x-init or x-data) it stopped working. v0.4.1 should fix this. Thanks!

dephiros commented 8 months ago

@imacrayon , I tested the fixes and it worked 🎉 🙏