#Javascript/Typescript modules are not loading when navigating forward/ back using ViewTransitions

4 messages · Page 1 of 1 (latest)

vague crag
#

I have a simple <script> at the bottom of a few components in my Astro 3 project and have set the header to use <ViewTransitions />. All the Javascript works until navigating to another page and returning to the page with the component. The javascript doesn't load.

How do these Astro script modules work with viewtransitions?

viral tangle
vague crag
#

Ok, thanks! Is it possible to only run the functions in the modules on certain pages?

viral tangle
#

You could make sure the script is only included on the pages that need it (an Astro layout is helpful for this)