fix(prefetch): Fix "tap" prefetch strategy when view transitions are enabled#14235
fix(prefetch): Fix "tap" prefetch strategy when view transitions are enabled#14235martrapp merged 12 commits intowithastro:mainfrom
Conversation
🦋 Changeset detectedLatest commit: cfa9165 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #14235 will not alter performanceComparing Summary
Footnotes |
It is tested in our e2e testing suite: https://github.com/withastro/astro/blob/main/packages/astro/e2e/prefetch.test.js Can you please add a new test that covers the fix, please? |
I meant that the exact behavior was not tested (prefetching multiple times with view transitions enabled), but now it is |
|
It seems that the test isn't passing? |
@ematipico should be fixed now |
martrapp
left a comment
There was a problem hiding this comment.
LGTM!
and thank you very much for the thorough test coverage!
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> Co-authored-by: Matthew Phillips <matthewp@users.noreply.github.com> Co-authored-by: Houston (Bot) <108291165+astrobot-houston@users.noreply.github.com> Co-authored-by: Bartosz Kapciak <bartosz.kapciak@swmansion.com> Co-authored-by: Bartosz Kapciak <martrapp@users.noreply.github.com> Co-authored-by: Armand Philippot <git@armand.philippot.eu> Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Co-authored-by: Abdelrahman Abdelfattah <spices.digital@gmail.com> Co-authored-by: Alasdair McLeay <penx@users.noreply.github.com> Fix failing x-forwarded-host tests (#14505) fix(prefetch): Fix "tap" prefetch strategy when view transitions are enabled (#14235) fix `security.allowedDomains` version (#14509) Fix compatibility with older Astro versions in @astrojs/node (#14514) Fixes #14513 fix heading level in config reference docs (#14517) fix(deps): update all non-major dependencies (#14522)
Changes
The "tap" prefetch strategy was the only strategy that didn't call onPageLoad to attach event listeners to new elements. This caused "tap" to only work on the first clicked link when view transitions were enabled.
Testing
New tests are added to e2e/prefetch.test.js that check if each prefetch strategy works correctly with view transitions
Docs
No docs added since this is a bugfix.