Couple not so favorable behaviors with vt implemented (many in my case/project https://sayings.cc) and observations from others in the wild
-
Page loading takes a lagging. I've tested a couple times by turning off and on vt and notice the page load speed drops when vt enabled (erratic but can be observed if you spend time clicking around, when you see (4) below sometimes you then click multiple times forgetting you already clicked because there's an obvious pause before action, maybe a loading state can fix this (Astro can make this opt-in, if using vt)).
-
Certain scripts would not re-trigger. In my specific case, following the doc, I've had to try to re-trigger gsap
astro:after-swapand instead of playing on subsequent page visit, it errors, without which it plays it only on full refresh. Mind you all such scripts are loadedastro:page-load. -
Despite having this snippet
document.addEventListener('astro:after-swap', () => window.scrollTo({ left: 0, top: 0 }))Astro still "remembers" the scroll position of the last page and returns scroll there when go back. My expectation is that I'm "after-swapping" the page back to top, drag the scroll all the way top before/while loading page. Of course, refreshing present page would be browser's default of taking down your former scroll position so that would be expected. -
Following from (1) there's this "batch loading" behavior where as if because of the lag, when Astro eventually wakes up, it remembers all the clicks then it doesn't just load the last page click but cycles through, so the page just keeps changing.
-
My suggestion for preventing (4) is not necessarily vt related but Astro generally. I think before Astro should load/swap a page (dunno if this goes against Astro's philosophy, since not wanting to load scripts to client, then it can be opt-in), it should check if the url matches with the initiating click/link and if it does - either do nothing or prevent pointer events.