Replies: 2 comments 2 replies
-
|
Okay, so after hours of grind some of the points that I want to put out here just in case someone else is looking for similar issue are:
So the solution that is astro-standard and works all the time is that use alpine integration with Also, I think there should be a section for integrations in Alpine documentation as well so that people doesn't start tripping for most trivial things like this. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, you'd need to make sure the scripts evaluate before Alpine does anything. so you could use some of the internal Alpine APIs like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've a form components on a page Astro that has a
Alpine.datawithin a<script>. I am using the astro ViewTransition API for client side routing. When I directly load the form page, it works completely fine with Astro.data properly initialised but when I start form some other page and navigate to the form, it throws Uncaught Reference errors because the Alpine.data is not initialised at all. I've opted out of the Client Routing using ViewTransition and now it's working fine.The problem I feel is ViewTransition is intercepts the navigation loads the HTML first without running the script and initializing alpine data. I looked through the discussions and haven't seen anybody facing this issue, given that Alpine is used with astro more.
Beta Was this translation helpful? Give feedback.
All reactions