Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support prefetch in core #8951

Merged
merged 14 commits into from
Nov 8, 2023
Merged

Support prefetch in core #8951

merged 14 commits into from
Nov 8, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 30, 2023

Changes

close #8926

Add new prefetch option. Supersedes @astrojs/prefetch. Check the docs and RFC for more information on how it works.

Tip for reviewing

  • The core logic changes are in src/core. src/core/prefetch/index.ts contains the client-side script.

  • The documentation is in the changeset and src/@types/astro/ts. They take a lot of lines, and the docs for prefetch.prefetchAll and prefetch.defaultStrategy are duplicated. I think it's needed for docs to detect it.

Testing

Added e2e tests to make sure a request is sent

Docs

Main docs: withastro/docs#5271

This PR also has changesets and JSDoc for review.

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2023

🦋 Changeset detected

Latest commit: d89b60e

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

@github-actions github-actions bot added pkg: example Related to an example package (scope) pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Oct 30, 2023
@martrapp
Copy link
Member

LVGTM: I am very happy that the different prefetch approaches are unified here and the special handling in ViewTransition.astro is replaced by core functions!

@github-actions github-actions bot removed the pkg: example Related to an example package (scope) label Nov 2, 2023
@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Nov 2, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@bluwy bluwy marked this pull request as ready for review November 3, 2023 10:01
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/prefetch/index.ts Outdated Show resolved Hide resolved
packages/astro/src/prefetch/index.ts Show resolved Hide resolved
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this, @bluwy and I'm also getting into the docs PR for this too!

I left some suggestions, mostly about getting explicit options shown etc. as this is a reference page and people might be coming here to look something up or check on it quickly. Duplication of content here and in the guide isn't always a bad thing, since the guide will walk through more and this can be for people who already pretty much know what the feature is about, they just don't know for example all the possible hover, tap etc.

Also, I do not know what's up with documenting the options twice. We're going to need to call in someone else to confirm that.

.changeset/sixty-laws-argue.md Show resolved Hide resolved
.changeset/sixty-laws-argue.md Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Nov 7, 2023
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look great!

@bluwy bluwy merged commit 38e21d1 into main Nov 8, 2023
14 checks passed
@bluwy bluwy deleted the prefetch-core branch November 8, 2023 14:07
@astrobot-houston astrobot-houston mentioned this pull request Nov 8, 2023
natemoo-re pushed a commit that referenced this pull request Nov 22, 2023
Co-authored-by: Sarah Rainsberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope) pr: docs A PR that includes documentation for review semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to disable prefetch with ViewTransitions
5 participants