-
Notifications
You must be signed in to change notification settings - Fork 403
-
Notifications
You must be signed in to change notification settings - Fork 403
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
No prefetching occurs for duplicate links #387
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When a link appears on the page twice ‒ once inside and once outside the viewport ‒ and a delay has been set, the link will not cause prefetching/prerendering.
To Reproduce
Expected behavior
The page to be prefetched, as at least one link to it is in-viewport.
The
IntersectionObserver
detects that the first link is in-viewport, and appropriately pushes into thehrefsInViewport
array. It immediately afterwards detects that the second link is not in-viewport, and thus removes the freshly added item fromhrefsInViewport
.hrefsInViewport
‒ as the name suggests ‒ contains hrefs, thus links with equal hrefs are indistinguishable in this context.I am willing to submit a PR, but would like to make I'm not the only one who thinks this is unexpected.
One possible solution would be storing some identifier for a link that is unique to it, rather than the href (which is not necessarily unique). Such an identifier could be generated like so:
The text was updated successfully, but these errors were encountered: