You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using HTMX with Astro (either by including the library via a script tag in the head or via the Astro-Htmx integration), I was seeing this issue when using Astro's <ViewTransistion> component in its simplest mode:
After transitioning to a new page, Htmx, while loaded, ignored any attributes declared on the new page.
It seems the ViewTransition implementation was hiding or blocking the page load event.
Solution found by wrapping Astro's component with a custom helper that implements a listener for an Astro event and executes htmx.process() on the body.
When using HTMX with Astro (either by including the library via a
script
tag in thehead
or via the Astro-Htmx integration), I was seeing this issue when using Astro's<ViewTransistion>
component in its simplest mode:It seems the ViewTransition implementation was hiding or blocking the
page load
event.Solution found by wrapping Astro's component with a custom helper that implements a listener for an Astro event and executes
htmx.process()
on the body.A gist is here: https://gist.github.com/netaisllc/3cc72bb35ace64ceca4425374e452930
Credits to Flavio Copes (https://flaviocopes.com/htmx-and-astro-view-transitions/) for the idea and Yay for Htmx's event based architecture.
Leaving this here for any others to follow or remarks on.
The text was updated successfully, but these errors were encountered: