-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: improved Link prefetching behavior, API, and docs; make it similar to Next.js #4678
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run & review this pull request in StackBlitz Codeflow. |
👷 Deploy request for qwik-insights pending review.Visit the deploys page to approve it
|
jordanw66
changed the title
feat: Link prefetches symbols by default
feat: Link prefetches symbols (by default)
Jul 1, 2023
jordanw66
changed the title
feat: Link prefetches symbols (by default)
feat: improved Link prefetching behavior, API, and docs; make it similar to Next.js
Jul 8, 2023
zanettin
added
the
WAITING FOR: team
Waiting for one of the core team members to review and reply
label
Aug 22, 2023
@jordanw66 this is great! Could I implore you to rebase? An e2e test would be very nice too, just not quite sure how to test prefetching. |
@jordanw66 wow, I'm glad you're back now! Totally understand, if you could do a quick rebase that would be fine. |
Closing in favor of #5480 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR makes
prefetch
onLink
similar to prefetch onNext.js
:on:qvisible
.prefetch={false}
.prefetch="js"
.mouseover
orfocus
instead ofqvisible
.data saver
setting set, prefetching is skipped.Link
. (hashes, navbar, etc)prefetch
does and how it works, along with options.aria-pressed
because this is for toggle buttons, not<a>
tags. Screen readers already handle links, in fact adding and removingaria-pressed
will cause confusion for these users as it's not normal link behavior.pathname
comparison by normalizing path trailing slashes first, added unit tests for this.Prefetching symbols (and/or data) to render a page before SPA navigation is a huge boost to user experience, especially on slow/mobile connections, preventing a burst of network activity during navigation.
If you think defaults or API should be different let me know.
References:
https://nextjs.org/docs/pages/api-reference/components/link#prefetch
https://nextjs.org/docs/messages/prefetch-true-deprecated
https://www.builder.io/blog/prefetching-nextjs-visual-guide
https://www.accessibility-developer-guide.com/examples/sensible-aria-usage/pressed/#intended-use
What is it?
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Use cases and why
Checklist: