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.
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: add
prefetch="viewport"
support to<Link>
#6433feat: add
prefetch="viewport"
support to<Link>
#6433Changes from 5 commits
e24f65d
331e8b3
4520f0f
acd4645
ee74d1b
fab2cce
44f28f3
c3e9ded
219057f
748d6a0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the observer be disconnected after prefetch is set? That way the IntersectionObserver doesn't need to keep observing if
ref.current
is in the viewportThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly depends on if we should clean up link preloads when the link leaves the viewport. another thing would be that if it re-enters the vp, should it refetch the loader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing/re-adding link tags if an element scrolled out of and back into the viewport would be consistent with our
prefetch="intent"
behaviorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any internal react overhead in attaching a ref? This feels potentially troublesome since we now attach a
ref
to every Link, even if the user didn't forward a ref and if they're not usingprefetch="viewport"
. Does a page with hundreds of links get immediately "slower" with no way for the user to opt out of the refs?I took a stab at an opt-in ref approach in 44f28f3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no perf hit per @jacob-ebey so going to back out that commit