imacrayon / alpine-ajax

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

New links are not progressively enhanced #2

Closed imacrayon closed 1 year ago

imacrayon commented 1 year ago

Links added to the DOM after an Ajax component is initialized are not progressively enhanced.

The work around for now is to add thex-ajax directive to new links. The directive will trigger an Alpine component to re-initialize.

imacrayon commented 1 year ago

I think the fix for this is to use morph’s added(el) hook. When a link element is patched into the DOM progressively enhance it if it belongs to an AJAX component.